pull_requests: 64042989
This data as json
id | node_id | number | state | locked | title | user | body | created_at | updated_at | closed_at | merged_at | merge_commit_sha | assignee | milestone | draft | head | base | author_association | auto_merge | repo | url | merged_by |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
64042989 | MDExOlB1bGxSZXF1ZXN0NjQwNDI5ODk= | 802 | closed | 0 | Multi-index indexing | 4160723 | Follows #767. This is incomplete (it still needs some tests and documentation updates), but it is working for both `Dataset` and `DataArray` objects. I also don't know if it is fully compatible with lazy indexing (Dask). Using the example from #767: ``` In [4]: da.sel(band_wavenumber={'band': 'foo'}) Out[4]: <xarray.DataArray (wavenumber: 2)> array([ 0.00017, 0.00014]) Coordinates: * wavenumber (wavenumber) float64 4.05e+03 4.05e+03 ``` As shown in this example, similarily to pandas, it automatically renames the dimension and assigns a new coordinate when the selection doesn't return a `pd.MultiIndex` (here it returns a `pd.FloatIndex`). In some cases this behavior may be unwanted (??), so I added a `drop_level` keyword argument (if `False` it keeps the multi-index and doesn't change the dimension/coordinate names): ``` In [5]: da.sel(band_wavenumber={'band': 'foo'}, drop_level=False) Out[5]: <xarray.DataArray (band_wavenumber: 2)> array([ 0.00017, 0.00014]) Coordinates: * band_wavenumber (band_wavenumber) object ('foo', 4050.2) ('foo', 4050.3) ``` Note that it also works with `DataArray.loc`, but (for now) in that case it always returns the multi-index: ``` In [6]: da.loc[{'band_wavenumber': {'band': 'foo'}}] Out[6]: <xarray.DataArray (band_wavenumber: 2)> array([ 0.00017, 0.00014]) Coordinates: * band_wavenumber (band_wavenumber) object ('foo', 4050.2) ('foo', 4050.3) ``` This is however inconsistent with `Dataset.sel` and `Dataset.loc` that both apply `drop_level=True` by default, due to their different implementation. Two solutions: (1) make `DataArray.loc` apply drop_level by default, or (2) use `drop_level=False` by default everywhere. | 2016-03-24T14:39:38Z | 2016-07-19T10:48:56Z | 2016-07-19T01:15:42Z | 2016-07-19T01:15:41Z | 7a9e84b5708d3e8ec270a7415f9b5e54d30f13f7 | 0 | 712497c3997e72a36cafc8fb9eaafbecc76af5dc | 80abe5dede7bf8a2949139f8ba083a6d74d4e3db | MEMBER | 13221727 | https://github.com/pydata/xarray/pull/802 |
Links from other tables
- 0 rows from pull_requests_id in labels_pull_requests