home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

3 rows where author_association = "CONTRIBUTOR" and issue = 1548355645 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

  • maxrjones 3

issue 1

  • xr.DataSet.expand_dims axis option doesn't work · 3 ✖

author_association 1

  • CONTRIBUTOR · 3 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
1397637864 https://github.com/pydata/xarray/issues/7456#issuecomment-1397637864 https://api.github.com/repos/pydata/xarray/issues/7456 IC_kwDOAMm_X85TTkLo maxrjones 14077947 2023-01-19T21:34:09Z 2023-01-19T21:34:09Z CONTRIBUTOR

Okay I think I get the philosophy now. However, indexing a DataSet with an integer actually does work. If performance is the goal, shouldn't something like ds[0] throw a warning or an error?

Can you share your code for this? I would interpret that as meaning you have a variable in your dataset mapped to an integer key, which is allowed as a hashable type but can cause problems with downstream packages.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  xr.DataSet.expand_dims axis option doesn't work 1548355645
1397627848 https://github.com/pydata/xarray/issues/7456#issuecomment-1397627848 https://api.github.com/repos/pydata/xarray/issues/7456 IC_kwDOAMm_X85TThvI maxrjones 14077947 2023-01-19T21:24:30Z 2023-01-19T21:24:30Z CONTRIBUTOR

I'm not an xarray developer, but my guess is that your argument is why positional indexing/slicing is not available for datasets.

As for the specific case of using axis parameter of expand_dims, I think this is useful for the case in which the user is either confident about the axis order in each DataArray or will use label based operations such that axis order doesn’t matter. I was curious so I did a quick comparison of the speed for using this parameter versus a subsequent transpose operation: shape = (10, 50, 100, 200) ds = xr.Dataset( { "foo": (["time", "x", "y", "z"], np.random.rand(*shape)), "bar": (["time", "x", "y", "z"], np.random.randint(0, 10, shape)), }, { "time": (["time"], np.arange(shape[0])), "x": (["x"], np.arange(shape[1])), "y": (["y"], np.arange(shape[2])), "z": (["z"], np.arange(shape[3])), }, ) %%timeit -r 4 ds1 = ds.expand_dims("sample", axis=1) 38.1 µs ± 76 ns per loop (mean ± std. dev. of 4 runs, 10,000 loops each) %%timeit -r 4 ds2 = ds.expand_dims("sample").transpose("time", "sample", "x", "y", "z") 172 µs ± 612 ns per loop (mean ± std. dev. of 4 runs, 10,000 loops each)

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  xr.DataSet.expand_dims axis option doesn't work 1548355645
1397567627 https://github.com/pydata/xarray/issues/7456#issuecomment-1397567627 https://api.github.com/repos/pydata/xarray/issues/7456 IC_kwDOAMm_X85TTTCL maxrjones 14077947 2023-01-19T20:34:04Z 2023-01-19T20:34:04Z CONTRIBUTOR

Okay, regardless of expected behavior here, my particular use-case requires that I transpose these dimensions. Can someone show me a way to do this? I tried to explain the xarray point of view to Keras, but Keras is really not interested ;)

I tried something like ds.expand_dims("sample").transpose('sample','nlat','nlon') to complete futility, probably something to do with the Frozen stuff if I had to guess.

The transpose method should change the dimension order on each array in the dataset. One particularly important component from Kai's comment above is that ds.dims does not tell you information about the axis order for the DataArrays in the Dataset. Can you please describe how the DataArray dimension order reported by the code below differs from your expectations? for var in ds.data_vars: print(ds[var].sizes)

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  xr.DataSet.expand_dims axis option doesn't work 1548355645

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