|
2 | 2 | Base and utility classes for tseries type pandas objects.
|
3 | 3 | """
|
4 | 4 | import operator
|
5 |
| -from typing import Any, List, Optional, Set |
| 5 | +from typing import Any, List, Optional, Set, Union |
6 | 6 |
|
7 | 7 | import numpy as np
|
8 | 8 |
|
|
31 | 31 |
|
32 | 32 | from pandas.core import algorithms
|
33 | 33 | from pandas.core.accessor import PandasDelegate
|
34 |
| -from pandas.core.arrays import DatetimeArray, ExtensionArray, TimedeltaArray |
| 34 | +from pandas.core.arrays import DatetimeArray, PeriodArray, TimedeltaArray |
35 | 35 | from pandas.core.arrays.datetimelike import DatetimeLikeArrayMixin
|
36 | 36 | from pandas.core.base import _shared_docs
|
37 | 37 | import pandas.core.indexes.base as ibase
|
@@ -90,7 +90,7 @@ class DatetimeIndexOpsMixin(ExtensionIndex):
|
90 | 90 | Common ops mixin to support a unified interface datetimelike Index.
|
91 | 91 | """
|
92 | 92 |
|
93 |
| - _data: ExtensionArray |
| 93 | + _data: Union[DatetimeArray, TimedeltaArray, PeriodArray] |
94 | 94 | freq: Optional[DateOffset]
|
95 | 95 | freqstr: Optional[str]
|
96 | 96 | _resolution: int
|
@@ -468,7 +468,7 @@ def where(self, cond, other=None):
|
468 | 468 | result = np.where(cond, values, other).astype("i8")
|
469 | 469 | return self._shallow_copy(result)
|
470 | 470 |
|
471 |
| - def _summary(self, name=None): |
| 471 | + def _summary(self, name=None) -> str: |
472 | 472 | """
|
473 | 473 | Return a summarized representation.
|
474 | 474 |
|
@@ -955,15 +955,15 @@ class DatetimelikeDelegateMixin(PandasDelegate):
|
955 | 955 | _raw_methods: Set[str] = set()
|
956 | 956 | # raw_properties : dispatch properties that shouldn't be boxed in an Index
|
957 | 957 | _raw_properties: Set[str] = set()
|
958 |
| - _data: ExtensionArray |
| 958 | + _data: Union[DatetimeArray, TimedeltaArray, PeriodArray] |
959 | 959 |
|
960 | 960 | def _delegate_property_get(self, name, *args, **kwargs):
|
961 | 961 | result = getattr(self._data, name)
|
962 | 962 | if name not in self._raw_properties:
|
963 | 963 | result = Index(result, name=self.name)
|
964 | 964 | return result
|
965 | 965 |
|
966 |
| - def _delegate_property_set(self, name, value, *args, **kwargs): |
| 966 | + def _delegate_property_set(self, name: str, value, *args, **kwargs): |
967 | 967 | setattr(self._data, name, value)
|
968 | 968 |
|
969 | 969 | def _delegate_method(self, name, *args, **kwargs):
|
|
0 commit comments