File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -112,27 +112,28 @@ def to_dataset(self) -> Dataset:
112
112
raise NotImplementedError ()
113
113
114
114
def to_index (self , ordered_dims : Sequence [Hashable ] | None = None ) -> pd .Index :
115
- """Convert all index coordinates into a :py:class:`pandas.Index`.
115
+ """Convert all index dimension coordinates into a :py:class:`pandas.Index`.
116
116
117
117
Parameters
118
118
----------
119
119
ordered_dims : sequence of hashable, optional
120
- Possibly reordered version of this object's dimensions indicating
120
+ Possibly reordered version of this object's dimensions (or the full dimensions
121
+ of it's corresponding Dataset, DataArray or DataTree object) indicating
121
122
the order in which dimensions should appear on the result.
122
123
123
124
Returns
124
125
-------
125
126
pandas.Index
126
127
Index subclass corresponding to the outer-product of all dimension
127
128
coordinates. This will be a MultiIndex if this object is has more
128
- than more dimension.
129
+ than one dimension.
129
130
"""
130
131
if ordered_dims is None :
131
- ordered_dims = list (self .dims )
132
- elif set (ordered_dims ) != set (self .dims ):
132
+ ordered_dims = list (self ._data . dims )
133
+ elif set (ordered_dims ) != set (self ._data . dims ):
133
134
raise ValueError (
134
135
"ordered_dims must match dims, but does not: "
135
- f"{ ordered_dims } vs { self .dims } "
136
+ f"{ ordered_dims } vs { tuple ( self ._data . dims ) } "
136
137
)
137
138
138
139
if len (ordered_dims ) == 0 :
You can’t perform that action at this time.
0 commit comments