home / github

Menu
  • GraphQL API
  • Search all tables

issue_comments

Table actions
  • GraphQL API for issue_comments

10 rows where author_association = "MEMBER", issue = 167091064 and user = 1217238 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

  • shoyer · 10 ✖

issue 1

  • added to_dict function for xarray objects · 10 ✖

author_association 1

  • MEMBER · 10 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
254325079 https://github.com/pydata/xarray/pull/917#issuecomment-254325079 https://api.github.com/repos/pydata/xarray/issues/917 MDEyOklzc3VlQ29tbWVudDI1NDMyNTA3OQ== shoyer 1217238 2016-10-17T20:33:01Z 2016-10-17T20:33:01Z MEMBER

Up to you, but yes it would be greatly appreciated if you could work on this.

On Mon, Oct 17, 2016 at 12:15 PM, Julia Signell notifications@github.com wrote:

@shoyer https://github.com/shoyer is this something I should be working on? I am happy to, just don't know how this normally goes.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pydata/xarray/pull/917#issuecomment-254304733, or mute the thread https://github.com/notifications/unsubscribe-auth/ABKS1qqKU4SU-c_e533xHM0uyBibdRLpks5q08lGgaJpZM4JS9Hw .

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  added to_dict function for xarray objects 167091064
254233040 https://github.com/pydata/xarray/pull/917#issuecomment-254233040 https://api.github.com/repos/pydata/xarray/issues/917 MDEyOklzc3VlQ29tbWVudDI1NDIzMzA0MA== shoyer 1217238 2016-10-17T15:00:50Z 2016-10-17T15:00:50Z MEMBER

We should recommend decode_times=False in the docs but I would still make datetime/timedelta objects -- this feels like something that should be left up to users.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  added to_dict function for xarray objects 167091064
254224058 https://github.com/pydata/xarray/pull/917#issuecomment-254224058 https://api.github.com/repos/pydata/xarray/issues/917 MDEyOklzc3VlQ29tbWVudDI1NDIyNDA1OA== shoyer 1217238 2016-10-17T14:30:46Z 2016-10-17T14:30:46Z MEMBER

I think we should try to convert numpy scalars/arrays, because otherwise the data won't convert directly to JSON. Possibly could take a duck typing approach of looking for .item() or .tolist() methods?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  added to_dict function for xarray objects 167091064
239305203 https://github.com/pydata/xarray/pull/917#issuecomment-239305203 https://api.github.com/repos/pydata/xarray/issues/917 MDEyOklzc3VlQ29tbWVudDIzOTMwNTIwMw== shoyer 1217238 2016-08-11T21:54:35Z 2016-08-11T21:54:35Z MEMBER

Thank you @jsignell -- really nice work here!

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  added to_dict function for xarray objects 167091064
239215093 https://github.com/pydata/xarray/pull/917#issuecomment-239215093 https://api.github.com/repos/pydata/xarray/issues/917 MDEyOklzc3VlQ29tbWVudDIzOTIxNTA5Mw== shoyer 1217238 2016-08-11T16:30:17Z 2016-08-11T16:30:17Z MEMBER

I have a few minor suggestions, but otherwise this looks very nice!

To ensure that the documentation subpages are built for these methods (which makes the sphinx link work), you need to add them to doc/api.rst. These should go in the IO / Conversion section.

If you haven't tested the docs locally with make html, take a look at the development version of the docs (http://xarray.pydata.org/en/latest/) about 5-10 minutes after I merge this to make sure everything looks right. RST can be tricky to get right.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  added to_dict function for xarray objects 167091064
235345190 https://github.com/pydata/xarray/pull/917#issuecomment-235345190 https://api.github.com/repos/pydata/xarray/issues/917 MDEyOklzc3VlQ29tbWVudDIzNTM0NTE5MA== shoyer 1217238 2016-07-26T17:37:16Z 2016-08-11T16:25:47Z MEMBER

This looks like a great start, but to be really useful it needs a couple other things: - [x] corresponding Dataset.from_dict and DataArray.from_dict class methods for creating xarray datasets from the output of to_dict - [x] unit tests verifying that these methods output the expected thing, and that a dataset can be faithfully round-tripped through to_dict/from_dict - [x] a section in the "Serialization and IO" docs describing how to use these methods - [x] what's new note

Please ask if you need guidance on where to start for any of these! This will be a very welcome addition to xarray :).

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  added to_dict function for xarray objects 167091064
236409695 https://github.com/pydata/xarray/pull/917#issuecomment-236409695 https://api.github.com/repos/pydata/xarray/issues/917 MDEyOklzc3VlQ29tbWVudDIzNjQwOTY5NQ== shoyer 1217238 2016-07-31T04:41:08Z 2016-07-31T04:41:08Z MEMBER

This is looking pretty good! I think the main thing this needs now is a short section in the docs on IO methods :). Also, a note in "What's New".

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  added to_dict function for xarray objects 167091064
235654735 https://github.com/pydata/xarray/pull/917#issuecomment-235654735 https://api.github.com/repos/pydata/xarray/issues/917 MDEyOklzc3VlQ29tbWVudDIzNTY1NDczNQ== shoyer 1217238 2016-07-27T17:14:51Z 2016-07-27T17:14:51Z MEMBER

It would also be good to test roundtripping arrays with some NaN and NaT values as well

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  added to_dict function for xarray objects 167091064
235651997 https://github.com/pydata/xarray/pull/917#issuecomment-235651997 https://api.github.com/repos/pydata/xarray/issues/917 MDEyOklzc3VlQ29tbWVudDIzNTY1MTk5Nw== shoyer 1217238 2016-07-27T17:04:55Z 2016-07-27T17:04:55Z MEMBER

One big thing that from_dict needs is validation. If the input dict does not match the expected format (e.g., there is a missing field), the user should get a sensible error message so they understand what went wrong.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  added to_dict function for xarray objects 167091064
235641894 https://github.com/pydata/xarray/pull/917#issuecomment-235641894 https://api.github.com/repos/pydata/xarray/issues/917 MDEyOklzc3VlQ29tbWVudDIzNTY0MTg5NA== shoyer 1217238 2016-07-27T16:29:50Z 2016-07-27T16:29:50Z MEMBER

I think the datetime issue is a numpy bug related to https://github.com/numpy/numpy/issues/7619

We can work around this by casting to datetime64[ns]:

(Pdb) ds['t'].values.tolist() [1356998400000000000, 1357084800000000000, 1357171200000000000, 1357257600000000000, 1357344000000000000, 1357430400000000000, 1357516800000000000, 1357603200000000000, 1357689600000000000, 1357776000000000000] (Pdb) ds['t'].values.astype('datetime64[us]').tolist() [datetime.datetime(2013, 1, 1, 0, 0), datetime.datetime(2013, 1, 2, 0, 0), datetime.datetime(2013, 1, 3, 0, 0), datetime.datetime(2013, 1, 4, 0, 0), datetime.datetime(2013, 1, 5, 0, 0), datetime.datetime(2013, 1, 6, 0, 0), datetime.datetime(2013, 1, 7, 0, 0), datetime.datetime(2013, 1, 8, 0, 0), datetime.datetime(2013, 1, 9, 0, 0), datetime.datetime(2013, 1, 10, 0, 0)]

The same issue holds for timedelta:

(Pdb) (ds['t'] - ds['t'][0]).values.tolist() [0, 86400000000000, 172800000000000, 259200000000000, 345600000000000, 432000000000000, 518400000000000, 604800000000000, 691200000000000, 777600000000000] (Pdb) (ds['t'] - ds['t'][0]).values.astype('timedelta64[us]').tolist() [datetime.timedelta(0), datetime.timedelta(1), datetime.timedelta(2), datetime.timedelta(3), datetime.timedelta(4), datetime.timedelta(5), datetime.timedelta(6), datetime.timedelta(7), datetime.timedelta(8), datetime.timedelta(9)]

We can work around these by checking for timedelta64 or datetime64 dtypes (use np.issubdtype(values.dtype, np.datetime64), and using astype to convert to datetime64[us]/timedelta64[us].

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  added to_dict function for xarray objects 167091064

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