home / github

Menu
  • GraphQL API
  • Search all tables

issue_comments

Table actions
  • GraphQL API for issue_comments

1 row where issue = 523037716 and user = 6628425 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

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

user 1

  • spencerkclark · 1 ✖

issue 1

  • subtracting CFTimeIndex can cause pd.TimedeltaIndex to overflow · 1 ✖

author_association 1

  • MEMBER 1
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
554648042 https://github.com/pydata/xarray/issues/3535#issuecomment-554648042 https://api.github.com/repos/pydata/xarray/issues/3535 MDEyOklzc3VlQ29tbWVudDU1NDY0ODA0Mg== spencerkclark 6628425 2019-11-16T15:39:23Z 2019-11-16T15:39:23Z MEMBER

Thanks for raising this issue @mathause. In hindsight this does not surprise me. Pandas's strict use of nanosecond-resolution datetimes and timedeltas was part of the motivation for the CFTimeIndex. While convenient, because it allows us to re-use code already written in pandas, holding the result of the difference between two CFTimeIndexes in a TimedeltaIndex clearly prevents us from taking the difference between distant dates.

Perhaps a more robust (yet more complex) solution for https://github.com/pydata/xarray/issues/2484 would be to write a version of a TimedeltaIndex that does not internally cast the timedeltas to type np.timedelta64[ns], and rather leaves them as datetime.timedelta objects, which are the actual result of subtracting two sequences of cftime.datetime objects.

Regarding the combine_by_coords issue, though, there might be an easier fix. Is there a reason that first_items is an Index of length-one Indexes? It's not clear to me why that needs to be the case.

https://github.com/pydata/xarray/blob/56c16e4bf45a3771fd9acba76d802c0199c14519/xarray/core/combine.py#L91

It appears if we just select the first value of each index (i.e. a cftime.datetime object in this example), e.g.

python first_items = pd.Index([index[0] for index in indexes]) pandas's rank method works properly and combine_by_coords produces the correct result:

```

xr.combine_by_coords([d1, d2, d3]).time <xarray.DataArray 'time' (time: 3)> array([cftime.DatetimeGregorian(4500, 12, 31, 0, 0, 0, 0, 4, 365), cftime.DatetimeGregorian(4600, 12, 31, 0, 0, 0, 0, 2, 365), cftime.DatetimeGregorian(5100, 12, 31, 0, 0, 0, 0, 0, 365)], dtype=object) Coordinates: * time (time) object 4500-12-31 00:00:00 ... 5100-12-31 00:00:00 ```

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  subtracting CFTimeIndex can cause pd.TimedeltaIndex to overflow 523037716

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 1760.346ms · About: xarray-datasette