home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

3 rows where issue = 217347106 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: reactions, created_at (date), updated_at (date)

user 2

  • shoyer 2
  • benbovy 1

issue 1

  • Convert an existing xarray dimension into a MultiIndex · 3 ✖

author_association 1

  • MEMBER 3
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
289856794 https://github.com/pydata/xarray/issues/1331#issuecomment-289856794 https://api.github.com/repos/pydata/xarray/issues/1331 MDEyOklzc3VlQ29tbWVudDI4OTg1Njc5NA== shoyer 1217238 2017-03-28T18:11:02Z 2017-03-28T18:11:02Z MEMBER

Given your two Datasets and your desired result, why not simply using concat?

OK, I feel pretty dumb now. Yes, that's totally the right way to do this. For some reason I was fixated on converting each dataset individually to have a MultiIndex before combining them.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Convert an existing xarray dimension into a MultiIndex 217347106
289744550 https://github.com/pydata/xarray/issues/1331#issuecomment-289744550 https://api.github.com/repos/pydata/xarray/issues/1331 MDEyOklzc3VlQ29tbWVudDI4OTc0NDU1MA== benbovy 4160723 2017-03-28T11:46:34Z 2017-03-28T11:46:34Z MEMBER

Given your two Datasets and your desired result, why not simply using concat?

python xr.concat([ds1, ds2], dim='y').stack(yx=['y', 'x'])

<xarray.Dataset> Dimensions: (yx: 6) Coordinates: * yx (yx) MultiIndex - y (yx) object 'a' 'a' 'a' 'b' 'b' 'b' - x (yx) int64 1 2 3 1 2 3 Data variables: foo (yx) int64 1 2 3 4 5 6

I don't really understand your last comment (only using ds1). Am I missing something?

{
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Convert an existing xarray dimension into a MultiIndex 217347106
289559117 https://github.com/pydata/xarray/issues/1331#issuecomment-289559117 https://api.github.com/repos/pydata/xarray/issues/1331 MDEyOklzc3VlQ29tbWVudDI4OTU1OTExNw== shoyer 1217238 2017-03-27T19:27:27Z 2017-03-27T19:27:27Z MEMBER

Currently the best I have is: python (ds1.reset_index('x') .rename({'x': 'yx', 'x_': 'x'}) .assign_coords(y=lambda ds: (('yx',), [ds.y.item()] * 3)) .set_index(yx=['y', 'x'])) <xarray.Dataset> Dimensions: (yx: 3) Coordinates: * yx (yx) MultiIndex - y (yx) object 'a' 'a' 'a' - x (yx) int64 1 2 3 Data variables: foo (yx) int64 1 2 3 which is rather un-intuitive.

It occurs to me that maybe this is just a good use case for expand_dims (#1326), which could make this as simple as ds1.expand_dims('y').stack(yx=['y', 'x']))

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Convert an existing xarray dimension into a MultiIndex 217347106

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