|
80 | 80 | notna,
|
81 | 81 | )
|
82 | 82 |
|
| 83 | +from pandas.core.indexes.datetimes import DatetimeIndex |
| 84 | + |
83 | 85 | if TYPE_CHECKING:
|
84 | 86 | from pandas import Series
|
85 | 87 | from pandas.core.arrays import ExtensionArray
|
@@ -186,7 +188,7 @@ def maybe_downcast_to_dtype(result, dtype: Dtype):
|
186 | 188 | return result
|
187 | 189 |
|
188 | 190 |
|
189 |
| -def maybe_downcast_numeric(result, dtype: Dtype, do_round: bool = False): |
| 191 | +def maybe_downcast_numeric(result, dtype: DtypeObj, do_round: bool = False): |
190 | 192 | """
|
191 | 193 | Subset of maybe_downcast_to_dtype restricted to numeric dtypes.
|
192 | 194 |
|
@@ -330,8 +332,8 @@ def maybe_cast_result_dtype(dtype: DtypeObj, how: str) -> DtypeObj:
|
330 | 332 |
|
331 | 333 |
|
332 | 334 | def maybe_cast_to_extension_array(
|
333 |
| - cls: Type["ExtensionArray"], obj, dtype: Dtype = None |
334 |
| -): |
| 335 | + cls: Type["ExtensionArray"], obj: ArrayLike, dtype: Optional[ExtensionDtype] = None |
| 336 | +) -> ArrayLike: |
335 | 337 | """
|
336 | 338 | Call to `_from_sequence` that returns the object unchanged on Exception.
|
337 | 339 |
|
@@ -790,7 +792,7 @@ def infer_dtype_from_scalar(val, pandas_dtype: bool = False) -> Tuple[DtypeObj,
|
790 | 792 | # TODO: try to make the Any in the return annotation more specific
|
791 | 793 | def infer_dtype_from_array(
|
792 | 794 | arr, pandas_dtype: bool = False
|
793 |
| -) -> Tuple[DtypeObj, AnyArrayLike]: |
| 795 | +) -> Tuple[DtypeObj, ArrayLike]: |
794 | 796 | """
|
795 | 797 | Infer the dtype from an array.
|
796 | 798 |
|
@@ -1082,7 +1084,7 @@ def astype_nansafe(
|
1082 | 1084 |
|
1083 | 1085 | def maybe_convert_objects(
|
1084 | 1086 | values: np.ndarray, convert_numeric: bool = True
|
1085 |
| -) -> Union[np.ndarray, ABCDatetimeIndex]: |
| 1087 | +) -> Union[np.ndarray, DatetimeIndex]: |
1086 | 1088 | """
|
1087 | 1089 | If we have an object dtype array, try to coerce dates and/or numbers.
|
1088 | 1090 |
|
|
0 commit comments