home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

1 row where author_association = "MEMBER" and issue = 347558405 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 1

issue 1

  • expand_dims erases named dim in the array's coordinates · 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
410403455 https://github.com/pydata/xarray/issues/2340#issuecomment-410403455 https://api.github.com/repos/pydata/xarray/issues/2340 MDEyOklzc3VlQ29tbWVudDQxMDQwMzQ1NQ== shoyer 1217238 2018-08-03T23:50:21Z 2018-08-03T23:50:21Z MEMBER

Thanks for the very clear report!

I believe this is intentional behavior here. Let me try to clarify how xarray determines coordinates for a variable like expanded_slice.z. Xarray requires that dimensions of coordinates are a subset of dimensions for a DataArray. So when you pull out a coordinate from a DataArray, the rule xarray uses for determining coordinates on the new DataArray object is to include every coordinate from the original DataArray for which all dimensions still exist on new DataArray.

More specifically, let's look at what expanded_slice looks like: <xarray.DataArray (x: 1)> array([0.]) Coordinates: y int64 0 * x (x) int64 1 z int64 1 expanded_slice.z is a scalar DataArray, since z is a scalar: <xarray.DataArray 'z' ()> array(1) Coordinates: y int64 0 z int64 1 The coordinate x from expanded_slice is lost, because it goes along the x dimensions which is not found on expanded_slice.z.

To answer your specific questions:

is the relative order of dimensions maintained between data in the same dataset/dataarray?

No, not necessarily. It's possible to define coordinates with different dimension order than the DataArray itself (although this isn't recommended). For example: ```

xarray.DataArray(np.zeros((2, 2)), dims=['x', 'y'], coords={'foo': (('y', 'x'), np.zeros((2, 2)))}) <xarray.DataArray (x: 2, y: 2)> array([[0., 0.], [0., 0.]]) Coordinates: foo (y, x) float64 0.0 0.0 0.0 0.0 Dimensions without coordinates: x, y ```

Can coordinates have MORE dimensions than the array itself?

No, this isn't allowed by xarray's data model.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  expand_dims erases named dim in the array's coordinates 347558405

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