home / github

Menu
  • GraphQL API
  • Search all tables

issue_comments

Table actions
  • GraphQL API for issue_comments

4 rows where issue = 285349783 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 3
  • mcdevitts 1

author_association 2

  • MEMBER 3
  • NONE 1

issue 1

  • Empty DataArray should have a length of 0 · 4 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
354701098 https://github.com/pydata/xarray/issues/1807#issuecomment-354701098 https://api.github.com/repos/pydata/xarray/issues/1807 MDEyOklzc3VlQ29tbWVudDM1NDcwMTA5OA== shoyer 1217238 2018-01-02T04:12:35Z 2018-01-02T04:12:35Z MEMBER

0-dimensional numpy array don't have a length because it isn't entirely clear what that would mean. In many cases, NumPy treats them as equivalent to Python scalars (e.g., float), which doesn't have a defined length.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Empty DataArray should have a length of 0 285349783
354700693 https://github.com/pydata/xarray/issues/1807#issuecomment-354700693 https://api.github.com/repos/pydata/xarray/issues/1807 MDEyOklzc3VlQ29tbWVudDM1NDcwMDY5Mw== mcdevitts 13813076 2018-01-02T04:05:13Z 2018-01-02T04:05:13Z NONE

You're absolutely correct about the ndarray behavior; I was mistaken.

I mostly have the built-in python types in mind when looking for a length of 0. Now that I think of it, I've hit this same issue with ndarrays. I'm not sure what the "right" behavior would be here, since I'm not sure why the ndarrays behave differently than the base python types.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Empty DataArray should have a length of 0 285349783
354699725 https://github.com/pydata/xarray/issues/1807#issuecomment-354699725 https://api.github.com/repos/pydata/xarray/issues/1807 MDEyOklzc3VlQ29tbWVudDM1NDY5OTcyNQ== shoyer 1217238 2018-01-02T03:50:07Z 2018-01-02T03:50:07Z MEMBER

I agree that it is a little surprising that we create a scalar array for tuples instead of 1D array like NumPy. To be honest, I'm not entirely sure why we do that, but looking in git history suggests it had something to do with making it easier to support pandas.MultiIndex (which has scalar values given by tuples).

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Empty DataArray should have a length of 0 285349783
354699553 https://github.com/pydata/xarray/issues/1807#issuecomment-354699553 https://api.github.com/repos/pydata/xarray/issues/1807 MDEyOklzc3VlQ29tbWVudDM1NDY5OTU1Mw== shoyer 1217238 2018-01-02T03:47:10Z 2018-01-02T03:47:10Z MEMBER

Thanks for the report.

Creating a DataArray with a tuple actually creates a scalar (0-dimensional array): ``` In [40]: dr = xr.DataArray(())

In [41]: dr Out[41]: <xarray.DataArray ()> array((), dtype=object)

In [42]: dr.shape Out[42]: () `` We then raise aTypeError` when calculating the length of an empty DataArray, which is consistent with NumPy.

In contrast, if you make an empty DataArray with an empty list, you do get a 1D dimensional length 0 array: ``` In [54]: dr = xr.DataArray([])

In [55]: len(dr) Out[55]: 0

In [56]: dr.shape Out[56]: (0,) ```

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Empty DataArray should have a length of 0 285349783

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