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

Method _values

pandas/core/frame.py:1106–1123  ·  view source on GitHub ↗

Analogue to ._values that may return a 2D ExtensionArray.

(self)

Source from the content-addressed store, hash-verified

1104
1105 @property
1106 def _values(self) -> np.ndarray | DatetimeArray | TimedeltaArray | PeriodArray:
1107 """
1108 Analogue to ._values that may return a 2D ExtensionArray.
1109 """
1110 mgr = self._mgr
1111
1112 blocks = mgr.blocks
1113 if len(blocks) != 1:
1114 return ensure_wrapped_if_datetimelike(self.values)
1115
1116 arr = blocks[0].values
1117 if arr.ndim == 1:
1118 # non-2D ExtensionArray
1119 return self.values
1120
1121 # more generally, whatever we allow in NDArrayBackedExtensionBlock
1122 arr = cast("np.ndarray | DatetimeArray | TimedeltaArray | PeriodArray", arr)
1123 return arr.T
1124
1125 # ----------------------------------------------------------------------
1126 # Rendering Methods

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected