|
16 | 16 | TYPE_CHECKING,
|
17 | 17 | Any,
|
18 | 18 | cast,
|
| 19 | + List, |
19 | 20 | )
|
20 | 21 | import warnings
|
21 | 22 | import zoneinfo
|
@@ -675,7 +676,7 @@ def _is_boolean(self) -> bool:
|
675 | 676 |
|
676 | 677 | return is_bool_dtype(self.categories)
|
677 | 678 |
|
678 |
| - def _get_common_dtype(self, dtypes: list[DtypeObj]) -> DtypeObj | None: |
| 679 | + def _get_common_dtype(self, dtypes: List[DtypeObj]) -> DtypeObj | None: |
679 | 680 | # check if we have all categorical dtype with identical categories
|
680 | 681 | if all(isinstance(x, CategoricalDtype) for x in dtypes):
|
681 | 682 | first = dtypes[0]
|
@@ -966,7 +967,7 @@ def __setstate__(self, state) -> None:
|
966 | 967 | self._tz = state["tz"]
|
967 | 968 | self._unit = state["unit"]
|
968 | 969 |
|
969 |
| - def _get_common_dtype(self, dtypes: list[DtypeObj]) -> DtypeObj | None: |
| 970 | + def _get_common_dtype(self, dtypes: List[DtypeObj]) -> DtypeObj | None: |
970 | 971 | if all(isinstance(t, DatetimeTZDtype) and t.tz == self.tz for t in dtypes):
|
971 | 972 | np_dtype = np.max([cast(DatetimeTZDtype, t).base for t in [self, *dtypes]])
|
972 | 973 | unit = np.datetime_data(np_dtype)[0]
|
@@ -1479,7 +1480,7 @@ def __from_arrow__(self, array: pa.Array | pa.ChunkedArray) -> IntervalArray:
|
1479 | 1480 | )
|
1480 | 1481 | return IntervalArray._concat_same_type(results)
|
1481 | 1482 |
|
1482 |
| - def _get_common_dtype(self, dtypes: list[DtypeObj]) -> DtypeObj | None: |
| 1483 | + def _get_common_dtype(self, dtypes: List[DtypeObj]) -> DtypeObj | None: |
1483 | 1484 | if not all(isinstance(x, IntervalDtype) for x in dtypes):
|
1484 | 1485 | return None
|
1485 | 1486 |
|
@@ -1677,7 +1678,7 @@ def from_numpy_dtype(cls, dtype: np.dtype) -> BaseMaskedDtype:
|
1677 | 1678 | else:
|
1678 | 1679 | raise NotImplementedError(dtype)
|
1679 | 1680 |
|
1680 |
| - def _get_common_dtype(self, dtypes: list[DtypeObj]) -> DtypeObj | None: |
| 1681 | + def _get_common_dtype(self, dtypes: List[DtypeObj]) -> DtypeObj | None: |
1681 | 1682 | # We unwrap any masked dtypes, find the common dtype we would use
|
1682 | 1683 | # for that, then re-mask the result.
|
1683 | 1684 | from pandas.core.dtypes.cast import find_common_type
|
@@ -2104,7 +2105,7 @@ def _subtype_with_str(self):
|
2104 | 2105 | return type(self.fill_value)
|
2105 | 2106 | return self.subtype
|
2106 | 2107 |
|
2107 |
| - def _get_common_dtype(self, dtypes: list[DtypeObj]) -> DtypeObj | None: |
| 2108 | + def _get_common_dtype(self, dtypes: List[DtypeObj]) -> DtypeObj | None: |
2108 | 2109 | # TODO for now only handle SparseDtypes and numpy dtypes => extend
|
2109 | 2110 | # with other compatible extension dtypes
|
2110 | 2111 | from pandas.core.dtypes.cast import np_find_common_type
|
@@ -2419,7 +2420,7 @@ def _is_boolean(self) -> bool:
|
2419 | 2420 | """
|
2420 | 2421 | return pa.types.is_boolean(self.pyarrow_dtype)
|
2421 | 2422 |
|
2422 |
| - def _get_common_dtype(self, dtypes: list[DtypeObj]) -> DtypeObj | None: |
| 2423 | + def _get_common_dtype(self, dtypes: List[DtypeObj]) -> DtypeObj | None: |
2423 | 2424 | # We unwrap any masked dtypes, find the common dtype we would use
|
2424 | 2425 | # for that, then re-mask the result.
|
2425 | 2426 | # Mirrors BaseMaskedDtype
|
|
0 commit comments