Get the ndarray or ExtensionArray that we can pass to the IndexEngine constructor.
(self)
| 5125 | return self._data |
| 5126 | |
| 5127 | def _get_engine_target(self) -> ArrayLike: |
| 5128 | """ |
| 5129 | Get the ndarray or ExtensionArray that we can pass to the IndexEngine |
| 5130 | constructor. |
| 5131 | """ |
| 5132 | vals = self._values |
| 5133 | if isinstance(vals, StringArray): |
| 5134 | # GH#45652 much more performant than ExtensionEngine |
| 5135 | return vals._ndarray |
| 5136 | if isinstance(vals, ArrowExtensionArray) and self.dtype.kind in "Mm": |
| 5137 | import pyarrow as pa |
| 5138 | |
| 5139 | pa_type = vals._pa_array.type |
| 5140 | if pa.types.is_timestamp(pa_type): |
| 5141 | vals = vals._to_datetimearray() |
| 5142 | return vals._ndarray.view("i8") |
| 5143 | elif pa.types.is_duration(pa_type): |
| 5144 | vals = vals._to_timedeltaarray() |
| 5145 | return vals._ndarray.view("i8") |
| 5146 | if ( |
| 5147 | type(self) is Index |
| 5148 | and isinstance(self._values, ExtensionArray) |
| 5149 | and not isinstance(self._values, BaseMaskedArray) |
| 5150 | and not ( |
| 5151 | isinstance(self._values, ArrowExtensionArray) |
| 5152 | and is_numeric_dtype(self.dtype) |
| 5153 | # Exclude decimal |
| 5154 | and self.dtype.kind != "O" |
| 5155 | ) |
| 5156 | ): |
| 5157 | # TODO(ExtensionIndex): remove special-case, just use self._values |
| 5158 | return self._values.astype(object) |
| 5159 | return vals |
| 5160 | |
| 5161 | @final |
| 5162 | def _get_join_target(self) -> np.ndarray: |
no test coverage detected