home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

2 rows where issue = 301031693 and user = 17178478 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

  • brynpickering · 2 ✖

issue 1

  • Removing dimensions from Dataset objects · 2 ✖

author_association 1

  • NONE 2
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
369315468 https://github.com/pydata/xarray/issues/1949#issuecomment-369315468 https://api.github.com/repos/pydata/xarray/issues/1949 MDEyOklzc3VlQ29tbWVudDM2OTMxNTQ2OA== brynpickering 17178478 2018-02-28T17:27:10Z 2018-02-28T17:27:38Z NONE

The drop technique seems reasonable, if a bit long-winded for the programmatic case (loop over all dimensions, find any that are empty -> loop over all variables, drop any that contain those empty dimensions).

As an addition, if the empty dimension also has an associated empty coordinate then it requires an extra step to get rid of it:

``` python In [21]: test_dataset = xr.Dataset(dict( ...: empty_array=xr.DataArray([], dims='a', coords={'a':[]}), ...: populated_array=xr.DataArray([1], {'b':['1']}, 'b') ...: ))

In [22]: test_dataset Out[22]: <xarray.Dataset> Dimensions: (a: 0, b: 1) Coordinates: * a (a) float64 * b (b) <U1 '1' Data variables: empty_array (a) float64 populated_array (b) int32 1

In [23]: test_dataset.drop('empty_array') Out[23]: <xarray.Dataset> Dimensions: (a: 0, b: 1) Coordinates: * a (a) float64 * b (b) <U1 '1' Data variables: populated_array (b) int32 1

In [24]: del test_dataset['a']

In [25]: test_dataset.drop('empty_array') Out[25]: <xarray.Dataset> Dimensions: (b: 1) Coordinates: * b (b) <U1 '1' Data variables: populated_array (b) int32 1 ```

Fixes seem reasonable, based on how we use xarray over at https://github.com/calliope-project/calliope/. The second one also provides more scope to remove subsets of data (all corresponding dims, coords, vars) if the dimension becomes superfluous for any reason, whether or not the dimension is empty.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Removing dimensions from Dataset objects 301031693
369247490 https://github.com/pydata/xarray/issues/1949#issuecomment-369247490 https://api.github.com/repos/pydata/xarray/issues/1949 MDEyOklzc3VlQ29tbWVudDM2OTI0NzQ5MA== brynpickering 17178478 2018-02-28T14:00:26Z 2018-02-28T14:00:26Z NONE

I don't think it's actually possible to purge a, hence why I started an issue rather than SO Q. As you can see, squeeze() removes b from the list of dimensions, but not a (as a has a length 0, not 1).

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Removing dimensions from Dataset objects 301031693

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