MCPcopy
hub / github.com/pandas-dev/pandas / _values

Method _values

pandas/core/indexes/multi.py:725–748  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

723
724 @cache_readonly
725 def _values(self) -> np.ndarray:
726 # We override here, since our parent uses _data, which we don't use.
727 values = []
728
729 for i in range(self.nlevels):
730 index = self.levels[i]
731 codes = self.codes[i]
732
733 vals = index
734 if isinstance(vals.dtype, CategoricalDtype):
735 vals = cast("CategoricalIndex", vals)
736 vals = vals._data._internal_get_values()
737
738 if isinstance(vals.dtype, ExtensionDtype) or lib.is_np_dtype(
739 vals.dtype, "mM"
740 ):
741 vals = vals.astype(object)
742
743 array_vals = np.asarray(vals)
744 array_vals = algos.take_nd(array_vals, codes, fill_value=index._na_value)
745 values.append(array_vals)
746
747 arr = lib.fast_zip(values)
748 return arr
749
750 @property
751 def values(self) -> np.ndarray:

Callers

nothing calls this directly

Calls 4

_internal_get_valuesMethod · 0.80
take_ndMethod · 0.80
astypeMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected