MCPcopy Index your code
hub / github.com/pydata/xarray / get_index

Method get_index

xarray/core/common.py:505–513  ·  view source on GitHub ↗

Get an index for a dimension, with fall-back to a default RangeIndex

(self, key: Hashable)

Source from the content-addressed store, hash-verified

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]]

Callers 11

drop_selMethod · 0.80
drop_iselMethod · 0.80
drop_duplicatesMethod · 0.80
to_indexMethod · 0.80
get_clean_interp_indexFunction · 0.80
_to_dataset_splitMethod · 0.80
to_pandasMethod · 0.80
test_get_indexMethod · 0.80
test_get_indexMethod · 0.80

Calls 1

to_pandas_indexMethod · 0.45

Tested by 4

test_get_indexMethod · 0.64
test_get_indexMethod · 0.64