|
59 | 59 | from pandas.core import ops |
60 | 60 | from pandas.core.accessor import PandasDelegate, delegate_names |
61 | 61 | import pandas.core.algorithms as algorithms |
62 | | -from pandas.core.algorithms import factorize, get_data_algo, take_1d, unique1d |
| 62 | +from pandas.core.algorithms import factorize, get_data_algo, take_nd, unique1d |
63 | 63 | from pandas.core.arrays._mixins import NDArrayBackedExtensionArray |
64 | 64 | from pandas.core.base import ExtensionArray, NoNewAttributesMixin, PandasObject |
65 | 65 | import pandas.core.common as com |
@@ -475,7 +475,7 @@ def astype(self, dtype: Dtype, copy: bool = True) -> ArrayLike: |
475 | 475 | msg = f"Cannot cast {self.categories.dtype} dtype to {dtype}" |
476 | 476 | raise ValueError(msg) |
477 | 477 |
|
478 | | - result = take_1d(new_cats, libalgos.ensure_platform_int(self._codes)) |
| 478 | + result = take_nd(new_cats, libalgos.ensure_platform_int(self._codes)) |
479 | 479 |
|
480 | 480 | return result |
481 | 481 |
|
@@ -1310,7 +1310,7 @@ def __array__(self, dtype: Optional[NpDtype] = None) -> np.ndarray: |
1310 | 1310 | if dtype==None (default), the same dtype as |
1311 | 1311 | categorical.categories.dtype. |
1312 | 1312 | """ |
1313 | | - ret = take_1d(self.categories._values, self._codes) |
| 1313 | + ret = take_nd(self.categories._values, self._codes) |
1314 | 1314 | if dtype and not is_dtype_equal(dtype, self.categories.dtype): |
1315 | 1315 | return np.asarray(ret, dtype) |
1316 | 1316 | # When we're a Categorical[ExtensionArray], like Interval, |
@@ -2349,7 +2349,7 @@ def _str_map(self, f, na_value=np.nan, dtype=np.dtype(object)): |
2349 | 2349 | categories = self.categories |
2350 | 2350 | codes = self.codes |
2351 | 2351 | result = PandasArray(categories.to_numpy())._str_map(f, na_value, dtype) |
2352 | | - return take_1d(result, codes, fill_value=na_value) |
| 2352 | + return take_nd(result, codes, fill_value=na_value) |
2353 | 2353 |
|
2354 | 2354 | def _str_get_dummies(self, sep="|"): |
2355 | 2355 | # sep may not be in categories. Just bail on this. |
@@ -2600,7 +2600,7 @@ def recode_for_categories( |
2600 | 2600 | indexer = coerce_indexer_dtype( |
2601 | 2601 | new_categories.get_indexer(old_categories), new_categories |
2602 | 2602 | ) |
2603 | | - new_codes = take_1d(indexer, codes, fill_value=-1) |
| 2603 | + new_codes = take_nd(indexer, codes, fill_value=-1) |
2604 | 2604 | return new_codes |
2605 | 2605 |
|
2606 | 2606 |
|
|
0 commit comments