Description
What is your issue?
xref #6795 (comment) and #6293 (Public API section).
The scipy22
branch contains the addition of a .set_xindex()
method to DataArray and Dataset so that participants at the SciPy 2022 Xarray sprint could experiment with custom indexes. After thinking more about it, I'm wondering if it couldn't actually be part of Xarray's public API alongside .set_index()
(at least for a while).
-
Having two methods
.set_xindex()
vs..set_index()
would be quite consistent with the.xindexes
vs..indexes
properties that are already there. -
I actually like the
.set_xindex()
API proposed in thescipy22
, i.e., setting one index at a time from one or more coordinates, possibly with build options. While it could be possible to support both that and.set_index()
's current API (quite specific to pandas multi-indexes) all in one method, it would certainly result in a much more confusing API and internal implementation. -
In the long term we could progressively get rid of
.indexes
and.set_index()
and/or rename.xindexes
to.indexes
and.set_xindex()
to.set_index()
.
Thoughts @pydata/xarray?