|
1 | 1 | """
|
2 | 2 | Base and utility classes for tseries type pandas objects.
|
3 | 3 | """
|
4 |
| -import operator |
5 |
| -from typing import Any, List, Optional, Set, Union |
| 4 | +from typing import Any, List, Optional, Union |
6 | 5 |
|
7 | 6 | import numpy as np
|
8 | 7 |
|
|
30 | 29 | from pandas.core.dtypes.missing import is_valid_nat_for_dtype, isna
|
31 | 30 |
|
32 | 31 | from pandas.core import algorithms
|
33 |
| -from pandas.core.accessor import PandasDelegate |
34 | 32 | from pandas.core.arrays import DatetimeArray, PeriodArray, TimedeltaArray
|
35 | 33 | from pandas.core.arrays.datetimelike import DatetimeLikeArrayMixin
|
36 | 34 | from pandas.core.base import _shared_docs
|
@@ -932,42 +930,3 @@ def insert(self, loc, item):
|
932 | 930 | raise TypeError(
|
933 | 931 | f"cannot insert {type(self).__name__} with incompatible label"
|
934 | 932 | )
|
935 |
| - |
936 |
| - |
937 |
| -class DatetimelikeDelegateMixin(PandasDelegate): |
938 |
| - """ |
939 |
| - Delegation mechanism, specific for Datetime, Timedelta, and Period types. |
940 |
| -
|
941 |
| - Functionality is delegated from the Index class to an Array class. A |
942 |
| - few things can be customized |
943 |
| -
|
944 |
| - * _delegated_methods, delegated_properties : List |
945 |
| - The list of property / method names being delagated. |
946 |
| - * raw_methods : Set |
947 |
| - The set of methods whose results should should *not* be |
948 |
| - boxed in an index, after being returned from the array |
949 |
| - * raw_properties : Set |
950 |
| - The set of properties whose results should should *not* be |
951 |
| - boxed in an index, after being returned from the array |
952 |
| - """ |
953 |
| - |
954 |
| - # raw_methods : dispatch methods that shouldn't be boxed in an Index |
955 |
| - _raw_methods: Set[str] = set() |
956 |
| - # raw_properties : dispatch properties that shouldn't be boxed in an Index |
957 |
| - _raw_properties: Set[str] = set() |
958 |
| - _data: Union[DatetimeArray, TimedeltaArray, PeriodArray] |
959 |
| - |
960 |
| - def _delegate_property_get(self, name, *args, **kwargs): |
961 |
| - result = getattr(self._data, name) |
962 |
| - if name not in self._raw_properties: |
963 |
| - result = Index(result, name=self.name) |
964 |
| - return result |
965 |
| - |
966 |
| - def _delegate_property_set(self, name: str, value, *args, **kwargs): |
967 |
| - setattr(self._data, name, value) |
968 |
| - |
969 |
| - def _delegate_method(self, name, *args, **kwargs): |
970 |
| - result = operator.methodcaller(name, *args, **kwargs)(self._data) |
971 |
| - if name not in self._raw_methods: |
972 |
| - result = Index(result, name=self.name) |
973 |
| - return result |
0 commit comments