home / github

Menu
  • GraphQL API
  • Search all tables

issue_comments

Table actions
  • GraphQL API for issue_comments

6 rows where issue = 1006413760 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: reactions, created_at (date), updated_at (date)

user 3

  • benbovy 3
  • hrzn 2
  • dcherian 1

author_association 2

  • MEMBER 4
  • CONTRIBUTOR 2

issue 1

  • Inconsistent dropping of `DatetimeIndex.freq` attribute from `DataArray`s index. · 6 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
927024549 https://github.com/pydata/xarray/issues/5815#issuecomment-927024549 https://api.github.com/repos/pydata/xarray/issues/5815 IC_kwDOAMm_X843QUWl hrzn 4806678 2021-09-25T07:17:19Z 2021-09-25T07:17:19Z CONTRIBUTOR

we have recently switched to using DataArray as the core data structure underlying the TimeSeries class of Darts (unit8co/darts)

We'd be happy to add this to https://xarray.pydata.org/en/stable/ecosystem.html if you can send in a PR!

Done! https://github.com/pydata/xarray/pull/5819 Thanks.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Inconsistent dropping of `DatetimeIndex.freq` attribute from `DataArray`s index. 1006413760
926947878 https://github.com/pydata/xarray/issues/5815#issuecomment-926947878 https://api.github.com/repos/pydata/xarray/issues/5815 IC_kwDOAMm_X843QBom dcherian 2448579 2021-09-24T22:16:53Z 2021-09-24T22:16:53Z MEMBER

we have recently switched to using DataArray as the core data structure underlying the TimeSeries class of Darts (unit8co/darts)

We'd be happy to add this to https://xarray.pydata.org/en/stable/ecosystem.html if you can send in a PR!

{
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Inconsistent dropping of `DatetimeIndex.freq` attribute from `DataArray`s index. 1006413760
926922607 https://github.com/pydata/xarray/issues/5815#issuecomment-926922607 https://api.github.com/repos/pydata/xarray/issues/5815 IC_kwDOAMm_X843P7dv hrzn 4806678 2021-09-24T21:13:03Z 2021-09-24T21:13:03Z CONTRIBUTOR

Yes this is a good point. In fact I'm not really willing to change the index in place, but I'm doing so because I've observed that the freq attribute of the index is dropped after sorting the array (see: https://github.com/pydata/xarray/issues/5466), so I use this hack to restore it.

Btw, we have recently switched to using DataArray as the core data structure underlying the TimeSeries class of Darts (https://github.com/unit8co/darts/), and it's working great for us. Thanks a lot for this super nice lib :)

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Inconsistent dropping of `DatetimeIndex.freq` attribute from `DataArray`s index. 1006413760
926882280 https://github.com/pydata/xarray/issues/5815#issuecomment-926882280 https://api.github.com/repos/pydata/xarray/issues/5815 IC_kwDOAMm_X843Pxno benbovy 4160723 2021-09-24T19:51:29Z 2021-09-24T19:51:29Z MEMBER

In your example it is safer to set freq when creating time_index.

Hmm time_index.freq seem to be ignored when passing the index to the DataArray constructor. We should probably fix that.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Inconsistent dropping of `DatetimeIndex.freq` attribute from `DataArray`s index. 1006413760
926877228 https://github.com/pydata/xarray/issues/5815#issuecomment-926877228 https://api.github.com/repos/pydata/xarray/issues/5815 IC_kwDOAMm_X843PwYs benbovy 4160723 2021-09-24T19:41:46Z 2021-09-24T19:41:46Z MEMBER

Beware when you set index attributes in place like xa_copy.get_index('time').freq = freq. Currently, Xarray internals are such that depending on how you access the index it may return distinct (although intially identical) objects, e.g.,

```python

xa_copy.get_index('time').freq = freq xa_copy._indexes['time'].index # freq set here DatetimeIndex(['2013-01-01', '2013-02-01', '2013-03-01', '2013-04-01', '2013-05-01', '2013-06-01', '2013-07-01', '2013-08-01', '2013-09-01', '2013-10-01'], dtype='datetime64[ns]', name='time', freq='MS') xa_copy._coords['time']._data.array # freq not set here DatetimeIndex(['2013-01-01', '2013-02-01', '2013-03-01', '2013-04-01', '2013-05-01', '2013-06-01', '2013-07-01', '2013-08-01', '2013-09-01', '2013-10-01'], dtype='datetime64[ns]', name='time', freq=None) xa_copy._coords['time']._data.array is xa_copy._indexes['time'].index False ```

Hopefully, this will become less likely after the ongoing explicit index refactor in Xarray. But in general I would not advise changing in-place pandas indexes that are already bound to xarray objects. In your example it is safer to set freq when creating time_index.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Inconsistent dropping of `DatetimeIndex.freq` attribute from `DataArray`s index. 1006413760
926855056 https://github.com/pydata/xarray/issues/5815#issuecomment-926855056 https://api.github.com/repos/pydata/xarray/issues/5815 IC_kwDOAMm_X843Pq-Q benbovy 4160723 2021-09-24T19:00:36Z 2021-09-24T19:00:36Z MEMBER

This is the behavior that we get when directly indexing the pandas.DatetimeIndex:

```python

idx = xa_orig.get_index('time') idx DatetimeIndex(['2013-01-01', '2013-02-01', '2013-03-01', '2013-04-01', '2013-05-01', '2013-06-01', '2013-07-01', '2013-08-01', '2013-09-01', '2013-10-01'], dtype='datetime64[ns]', name='time', freq='MS') idx[0:2] # slice of ints -> preserve freq DatetimeIndex(['2013-01-01', '2013-02-01'], dtype='datetime64[ns]', name='time', freq='MS') idx[[0, 1]] # list of ints -> drop freq DatetimeIndex(['2013-01-01', '2013-02-01'], dtype='datetime64[ns]', name='time', freq=None) ```

I think that this behavior makes sense since indexing the index with an arbitrary list of integer positions may not yield labels with a meaningful, unique frequency. With a slice it can be updated easily (pandas does it), e.g.,

```python

idx[0:2:4] DatetimeIndex(['2013-01-01'], dtype='datetime64[ns]', name='time', freq='4MS') ```

Not sure what's happening with the copy of the DataArray, though.

{
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Inconsistent dropping of `DatetimeIndex.freq` attribute from `DataArray`s index. 1006413760

Advanced export

JSON shape: default, array, newline-delimited, object

CSV options:

CREATE TABLE [issue_comments] (
   [html_url] TEXT,
   [issue_url] TEXT,
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [created_at] TEXT,
   [updated_at] TEXT,
   [author_association] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [performed_via_github_app] TEXT,
   [issue] INTEGER REFERENCES [issues]([id])
);
CREATE INDEX [idx_issue_comments_issue]
    ON [issue_comments] ([issue]);
CREATE INDEX [idx_issue_comments_user]
    ON [issue_comments] ([user]);
Powered by Datasette · Queries took 13.805ms · About: xarray-datasette