Put pandas.Index and numpy.ndarray arguments in adapter objects to ensure they can be indexed properly. NumpyArrayAdapter, PandasIndexingAdapter and LazilyIndexedArray should all pass through unmodified.
(data)
| 190 | |
| 191 | |
| 192 | def _maybe_wrap_data(data): |
| 193 | """ |
| 194 | Put pandas.Index and numpy.ndarray arguments in adapter objects to ensure |
| 195 | they can be indexed properly. |
| 196 | |
| 197 | NumpyArrayAdapter, PandasIndexingAdapter and LazilyIndexedArray should |
| 198 | all pass through unmodified. |
| 199 | """ |
| 200 | if isinstance(data, pd.Index): |
| 201 | return PandasIndexingAdapter(data) |
| 202 | if isinstance(data, UNSUPPORTED_EXTENSION_ARRAY_TYPES): |
| 203 | return data.to_numpy() |
| 204 | if isinstance( |
| 205 | data, pd.api.extensions.ExtensionArray |
| 206 | ) and is_allowed_extension_array(data): |
| 207 | return PandasExtensionArray(data) |
| 208 | return data |
| 209 | |
| 210 | |
| 211 | def _possibly_convert_objects(values): |
no test coverage detected
searching dependent graphs…