home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 78192774

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/issues/364#issuecomment-78192774 https://api.github.com/repos/pydata/xarray/issues/364 78192774 MDEyOklzc3VlQ29tbWVudDc4MTkyNzc0 1217238 2015-03-11T03:08:31Z 2015-03-11T03:08:31Z MEMBER

I don't think the timeofday issue is related to using Timedeltas in the index (and it's certainly not related to the ds['time.time'] issue). Also, it should be exactly equivalent to use timedelta64 or Timedelta -- both should convert to timedelta64 when put in an xray object.

Here's an example that seems to be working properly (except for uselessly display timedeltas in nanoseconds):

``` In [29]: time = pd.date_range('2000-01-01', freq='H', periods=100)

In [30]: daystart = time.to_period(freq='1D').to_datetime()

In [31]: timeofday = time.values - daystart.values

In [32]: ds = xray.Dataset({'data': ('time', range(100))}, {'time': time, 'timeofday': ('time', timeofday)})

In [33]: ds Out[33]: <xray.Dataset> Dimensions: (time: 100) Coordinates: timeofday (time) timedelta64[ns] 0 nanoseconds ... * time (time) datetime64[ns] 2000-01-01 2000-01-01T01:00:00 ... Data variables: data (time) int64 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 ...

In [34]: ds.groupby('timeofday').mean('time') Out[34]: <xray.Dataset> Dimensions: (timeofday: 24) Coordinates: * timeofday (timeofday) timedelta64[ns] 0 nanoseconds ... Data variables: data (timeofday) float64 48.0 49.0 50.0 51.0 40.0 41.0 42.0 43.0 44.0 45.0 46.0 ... ```

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