home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 349508097

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions performed_via_github_app issue
https://github.com/pydata/xarray/pull/1762#issuecomment-349508097 https://api.github.com/repos/pydata/xarray/issues/1762 349508097 MDEyOklzc3VlQ29tbWVudDM0OTUwODA5Nw== 1217238 2017-12-06T02:14:18Z 2017-12-06T02:14:18Z MEMBER

My main concern here is that pandas returns an array of datetime.date objects when you access .date. I think that's why we left it off in original implementation here: ``` In [1]: import pandas as pd

In [2]: t = pd.date_range('2010-01-01', periods=12, freq='3H')

In [3]: t Out[3]: DatetimeIndex(['2010-01-01 00:00:00', '2010-01-01 03:00:00', '2010-01-01 06:00:00', '2010-01-01 09:00:00', '2010-01-01 12:00:00', '2010-01-01 15:00:00', '2010-01-01 18:00:00', '2010-01-01 21:00:00', '2010-01-02 00:00:00', '2010-01-02 03:00:00', '2010-01-02 06:00:00', '2010-01-02 09:00:00'], dtype='datetime64[ns]', freq='3H')

In [4]: t.date Out[4]: array([datetime.date(2010, 1, 1), datetime.date(2010, 1, 1), datetime.date(2010, 1, 1), datetime.date(2010, 1, 1), datetime.date(2010, 1, 1), datetime.date(2010, 1, 1), datetime.date(2010, 1, 1), datetime.date(2010, 1, 1), datetime.date(2010, 1, 2), datetime.date(2010, 1, 2), datetime.date(2010, 1, 2), datetime.date(2010, 1, 2)], dtype=object) ```

Possibly implementing .dt.floor(), .dt.ceil() and .dt.round() (like pandas) would be a better way to do this? You would write something like da.time.dt.floor('1D') for this use-case.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  279595497
Powered by Datasette · Queries took 0.531ms · About: xarray-datasette