home / github

Menu
  • GraphQL API
  • Search all tables

issue_comments

Table actions
  • GraphQL API for issue_comments

4 rows where issue = 59720901 sorted by updated_at descending

✖
✖

✎ View and edit SQL

This data as json, CSV (advanced)

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

user 2

  • shoyer 2
  • darothen 2

author_association 2

  • MEMBER 2
  • NONE 2

issue 1

  • add .dt and .str accessors to DataArray (like pandas.Series) · 4 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
291611335 https://github.com/pydata/xarray/issues/358#issuecomment-291611335 https://api.github.com/repos/pydata/xarray/issues/358 MDEyOklzc3VlQ29tbWVudDI5MTYxMTMzNQ== shoyer 1217238 2017-04-04T19:46:39Z 2017-04-04T20:37:12Z MEMBER

Yes, looks pretty good. It would be nice to consolidate this with xarray's current logic for getting virtual datetime variables (they should probably delegate to the accessor): https://github.com/pydata/xarray/blob/94790388c273c0c1ce2c203940a706d331deb14f/xarray/core/dataset.py#L41

I wonder, is there any way to register such an accessor with DataArrays that have a specific dtype?

The simplest option is to raise AttributeError or TypeError in the constructor, e.g., python @xarray.register_dataarray_accessor('float_only') class FloatOnlyAccessor(object): def __init__(self, parent): if parent.dtype.kind != 'f': raise TypeError('wrong dtype') self.parent = parent

```

xarray.DataArray(1.5).float_only <main.FloatOnlyAccessor at 0x8d51350> xarray.DataArray(1).float_only TypeError: wrong dtype ```

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  add .dt and .str accessors to DataArray (like pandas.Series) 59720901
291568964 https://github.com/pydata/xarray/issues/358#issuecomment-291568964 https://api.github.com/repos/pydata/xarray/issues/358 MDEyOklzc3VlQ29tbWVudDI5MTU2ODk2NA== darothen 4992424 2017-04-04T17:14:18Z 2017-04-04T17:14:18Z NONE

Proof of concept, borrowing liberally from pandas. I think this will be pretty straightforward to hook up into xarray. I wonder, is there any way to register such an accessor with DataArrays that have a specific dtype? Ideally we'd only want to expose this accessor if a DataArray was a numpy.datetime64 type under the hood.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  add .dt and .str accessors to DataArray (like pandas.Series) 59720901
291232960 https://github.com/pydata/xarray/issues/358#issuecomment-291232960 https://api.github.com/repos/pydata/xarray/issues/358 MDEyOklzc3VlQ29tbWVudDI5MTIzMjk2MA== shoyer 1217238 2017-04-03T18:34:47Z 2017-04-03T18:34:47Z MEMBER

Yes, I think this would be quite straightforward. I think the easiest way to do it would simply be to reuse xarray's accessor interface (i.e., register_dataarray_accessor) and then implement all the desired methods/properties.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  add .dt and .str accessors to DataArray (like pandas.Series) 59720901
291228898 https://github.com/pydata/xarray/issues/358#issuecomment-291228898 https://api.github.com/repos/pydata/xarray/issues/358 MDEyOklzc3VlQ29tbWVudDI5MTIyODg5OA== darothen 4992424 2017-04-03T18:20:32Z 2017-04-03T18:20:32Z NONE

Working on a project today which would greatly benefit from having the .dt accessors. Given that this issue is nearly two years old, any thoughts on what it would take to resolve in the present codebase? Still as straightforward as wrappers on the pandas time series methods?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  add .dt and .str accessors to DataArray (like pandas.Series) 59720901

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 12.246ms · About: xarray-datasette
  • Sort ascending
  • Sort descending
  • Facet by this
  • Hide this column
  • Show all columns
  • Show not-blank rows