pull_requests: 1042357878
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1042357878 | PR_kwDOAMm_X84-IR52 | 6971 | closed | 0 | Add set_xindex and drop_indexes methods | 4160723 | <!-- Feel free to remove check-list items aren't relevant to your change --> - [x] Closes #6849 - [x] Supersedes #6800 - [x] Tests added - [x] User visible changes (including notable bug fixes) are documented in `whats-new.rst` - [x] New functions/methods are listed in `api.rst` This PR adds Dataset and DataArray `.set_xindex` and `.drop_indexes` methods (the latter is also discussed in #4366). I've cherry picked the relevant commits in the `scipy22` branch and added a few more commits. This PR also allows passing build options to any `Index`. Some comments and open questions: - Should we make the `index_cls` argument of `set_xindex` optional? - I.e., `set_index(coord_names, index_cls=None, **options)` where a pandas index is created by default (or a pandas multi-index if several coordinate names are given), provided that the coordinate(s) are valid 1-d candidates. - This would be redundant with the existing `set_index` method, but this would be convenient if we later depreciate it. - Should we depreciate `set_index` and `reset_index`? I think we should, but probably not at this point yet. - There's a special case for multi-indexes where `set_xindex(["foo", "bar"], PandasMultiIndex)` adds a dimension coordinate in addition to the "foo" and "bar" level coordinates so that it is consistent with the rest of Xarray. I find it a bit annoying, though. Probably another motivation for depreciating this dimension coordinate. - In this PR I also imported the `Index` base class in Xarray's root namespace. - It is needed for custom indexes and it's just a little more convenient than importing it from `xarray.core.indexes`. - Should we do the same for `PandasIndex` and `PandasMultiIndex` subclasses? Maybe if one wants to create a custom index inheriting from it. `PandasMultiIndex` factory methods could be also useful if we depreciate passing `pd.MultiIndex` objects as DataArray / Dataset coordinates. | 2022-08-31T12:54:35Z | 2022-12-08T09:38:13Z | 2022-09-28T07:25:15Z | 2022-09-28T07:25:15Z | e678a1d7884a3c24dba22d41b2eef5d7fe5258e7 | 0 | b598447ba2e9c98bb1186719dc9bc6be95e13042 | a042ae69c0444912f94bb4f29c93fa05046893ed | MEMBER | 13221727 | https://github.com/pydata/xarray/pull/6971 |
Links from other tables
- 1 row from pull_requests_id in labels_pull_requests