home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 418778596

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/2399#issuecomment-418778596 https://api.github.com/repos/pydata/xarray/issues/2399 418778596 MDEyOklzc3VlQ29tbWVudDQxODc3ODU5Ng== 1217238 2018-09-05T15:41:21Z 2018-09-05T15:41:21Z MEMBER

Thanks for the report!

This was actually a somewhat intentional omission in xarray, but if would not be particularly difficult to add in this feature if we want it. At the very least, we should note this deviation somewhere in the docs.

There are two potentially problematic aspects to the pandas behavior: 1. It means that you cannot count on indexing a dataframe with its own index to return something equivalent to the original dataframe, e.g., consider df.loc[['a', 'a']] in your example, which returns a dataframe with 4 rows. 2. More generally, it means you can't count on indexing a dataframe with an array to return an object of the same size as the indexer. This is particularly problematic for xarray, because we support vectorized indexing with multi-dimensional indexers. I don't know how we could define a multi-dimensional equivalent of this -- what shape should the result have if you indexed with a multi-dimensional array instead, e.g., da.loc[{"dim_0": xr.DataArray([['a']]}]? With multiple dimensions involved, it's not clear where the extra introduced dimensions should go.

Now that you bring this up, I wonder how the existing supporting for indexing like da.loc[{"dim_0": "a"}] would work if there are other multi-dimensional indexers. I don't know if we have test coverage for this...

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  357156174
Powered by Datasette · Queries took 0.557ms · About: xarray-datasette