home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 289559117

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions performed_via_github_app issue
https://github.com/pydata/xarray/issues/1331#issuecomment-289559117 https://api.github.com/repos/pydata/xarray/issues/1331 289559117 MDEyOklzc3VlQ29tbWVudDI4OTU1OTExNw== 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
}
  217347106
Powered by Datasette · Queries took 0.734ms · About: xarray-datasette