home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 1357296406

This data as json

id node_id number title user state locked assignee milestone comments created_at updated_at closed_at author_association active_lock_reason draft pull_request body reactions performed_via_github_app state_reason repo type
1357296406 PR_kwDOAMm_X84-IR52 6971 Add set_xindex and drop_indexes methods 4160723 closed 0     7 2022-08-31T12:54:35Z 2022-12-08T09:38:13Z 2022-09-28T07:25:15Z MEMBER   0 pydata/xarray/pulls/6971
  • [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.
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/6971/reactions",
    "total_count": 2,
    "+1": 2,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    13221727 pull

Links from other tables

  • 1 row from issues_id in issues_labels
  • 7 rows from issue in issue_comments
Powered by Datasette · Queries took 0.682ms · About: xarray-datasette