Get an index for a dimension, with fall-back to a default RangeIndex
(self, key: Hashable)
| 503 | ) |
| 504 | |
| 505 | def get_index(self, key: Hashable) -> pd.Index: |
| 506 | """Get an index for a dimension, with fall-back to a default RangeIndex""" |
| 507 | if key not in self.dims: |
| 508 | raise KeyError(key) |
| 509 | |
| 510 | try: |
| 511 | return self._indexes[key].to_pandas_index() |
| 512 | except KeyError: |
| 513 | return pd.Index(range(self.sizes[key]), name=key) |
| 514 | |
| 515 | def _calc_assign_results( |
| 516 | self: C, kwargs: Mapping[Any, T | Callable[[C], T]] |