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

Method to_index

xarray/core/variable.py:2970–2978  ·  view source on GitHub ↗

Convert this variable to a pandas.Index

(self)

Source from the content-addressed store, hash-verified

2968 return index
2969
2970 def to_index(self) -> pd.Index:
2971 """Convert this variable to a pandas.Index"""
2972 index = self._to_index()
2973 level = getattr(self._data, "level", None)
2974 if level is not None:
2975 # return multi-index level converted to a single index
2976 return index.get_level_values(level)
2977 else:
2978 return index
2979
2980 @property
2981 def level_names(self) -> list[Hashable | None] | None:

Callers 4

level_namesMethod · 0.95
get_level_variableMethod · 0.95
test_to_indexMethod · 0.95

Calls 1

_to_indexMethod · 0.95

Tested by 2

test_to_indexMethod · 0.76