|
34 | 34 | from pandas.core.arrays.sparse import SparseDtype
|
35 | 35 | from pandas.core.base import PandasObject
|
36 | 36 | from pandas.core.indexers import maybe_convert_indices
|
37 |
| -from pandas.core.indexes.api import Index, MultiIndex, ensure_index |
| 37 | +from pandas.core.indexes.api import Index, ensure_index |
38 | 38 | from pandas.core.internals.blocks import (
|
39 | 39 | Block,
|
40 | 40 | CategoricalBlock,
|
@@ -226,23 +226,6 @@ def set_axis(self, axis: int, new_labels: Index) -> None:
|
226 | 226 |
|
227 | 227 | self.axes[axis] = new_labels
|
228 | 228 |
|
229 |
| - def rename_axis( |
230 |
| - self, mapper, axis: int, copy: bool = True, level=None |
231 |
| - ) -> "BlockManager": |
232 |
| - """ |
233 |
| - Rename one of axes. |
234 |
| -
|
235 |
| - Parameters |
236 |
| - ---------- |
237 |
| - mapper : unary callable |
238 |
| - axis : int |
239 |
| - copy : bool, default True |
240 |
| - level : int or None, default None |
241 |
| - """ |
242 |
| - obj = self.copy(deep=copy) |
243 |
| - obj.set_axis(axis, _transform_index(self.axes[axis], mapper, level)) |
244 |
| - return obj |
245 |
| - |
246 | 229 | @property
|
247 | 230 | def _is_single_block(self) -> bool:
|
248 | 231 | if self.ndim == 1:
|
@@ -1972,28 +1955,6 @@ def _compare_or_regex_search(a, b, regex=False):
|
1972 | 1955 | return result
|
1973 | 1956 |
|
1974 | 1957 |
|
1975 |
| -def _transform_index(index, func, level=None): |
1976 |
| - """ |
1977 |
| - Apply function to all values found in index. |
1978 |
| -
|
1979 |
| - This includes transforming multiindex entries separately. |
1980 |
| - Only apply function to one level of the MultiIndex if level is specified. |
1981 |
| -
|
1982 |
| - """ |
1983 |
| - if isinstance(index, MultiIndex): |
1984 |
| - if level is not None: |
1985 |
| - items = [ |
1986 |
| - tuple(func(y) if i == level else y for i, y in enumerate(x)) |
1987 |
| - for x in index |
1988 |
| - ] |
1989 |
| - else: |
1990 |
| - items = [tuple(func(y) for y in x) for x in index] |
1991 |
| - return MultiIndex.from_tuples(items, names=index.names) |
1992 |
| - else: |
1993 |
| - items = [func(x) for x in index] |
1994 |
| - return Index(items, name=index.name, tupleize_cols=False) |
1995 |
| - |
1996 |
| - |
1997 | 1958 | def _fast_count_smallints(arr):
|
1998 | 1959 | """Faster version of set(arr) for sequences of small numbers."""
|
1999 | 1960 | counts = np.bincount(arr.astype(np.int_))
|
|
0 commit comments