|
29 | 29 | lib,
|
30 | 30 | properties,
|
31 | 31 | reshape,
|
32 |
| - tslibs, |
33 | 32 | )
|
34 | 33 | from pandas._libs.lib import no_default
|
35 | 34 | from pandas._typing import (
|
|
132 | 131 | )
|
133 | 132 | from pandas.core.indexes.accessors import CombinedDatetimelikeProperties
|
134 | 133 | from pandas.core.indexes.api import (
|
135 |
| - CategoricalIndex, |
136 | 134 | DatetimeIndex,
|
137 | 135 | Float64Index,
|
138 | 136 | Index,
|
139 | 137 | MultiIndex,
|
140 | 138 | PeriodIndex,
|
141 |
| - TimedeltaIndex, |
142 | 139 | default_index,
|
143 | 140 | ensure_index,
|
144 | 141 | )
|
@@ -570,36 +567,6 @@ def _constructor_expanddim(self) -> Callable[..., DataFrame]:
|
570 | 567 | def _can_hold_na(self) -> bool:
|
571 | 568 | return self._mgr._can_hold_na
|
572 | 569 |
|
573 |
| - def _set_axis(self, axis: AxisInt, labels: AnyArrayLike | list) -> None: |
574 |
| - """ |
575 |
| - Override generic, we want to set the _typ here. |
576 |
| -
|
577 |
| - This is called from the cython code when we set the `index` attribute |
578 |
| - directly, e.g. `series.index = [1, 2, 3]`. |
579 |
| - """ |
580 |
| - labels = ensure_index(labels) |
581 |
| - |
582 |
| - if labels._is_all_dates and not ( |
583 |
| - type(labels) is Index and not isinstance(labels.dtype, np.dtype) |
584 |
| - ): |
585 |
| - # exclude e.g. timestamp[ns][pyarrow] dtype from this casting |
586 |
| - deep_labels = labels |
587 |
| - if isinstance(labels, CategoricalIndex): |
588 |
| - deep_labels = labels.categories |
589 |
| - |
590 |
| - if not isinstance( |
591 |
| - deep_labels, (DatetimeIndex, PeriodIndex, TimedeltaIndex) |
592 |
| - ): |
593 |
| - try: |
594 |
| - labels = DatetimeIndex(labels) |
595 |
| - except (tslibs.OutOfBoundsDatetime, ValueError): |
596 |
| - # labels may exceeds datetime bounds, |
597 |
| - # or not be a DatetimeIndex |
598 |
| - pass |
599 |
| - |
600 |
| - # The ensure_index call above ensures we have an Index object |
601 |
| - self._mgr.set_axis(axis, labels) |
602 |
| - |
603 | 570 | # ndarray compatibility
|
604 | 571 | @property
|
605 | 572 | def dtype(self) -> DtypeObj:
|
|
0 commit comments