Skip to content

Commit 40cf38f

Browse files
committed
feedback
1 parent 3dfb584 commit 40cf38f

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

pandas/core/dtypes/cast.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@
7575
from pandas.core.dtypes.inference import is_list_like
7676
from pandas.core.dtypes.missing import is_valid_nat_for_dtype, isna, notna
7777

78+
from pandas.core.indexes.datetimes import DatetimeIndex
79+
7880
if TYPE_CHECKING:
7981
from pandas import Series
8082
from pandas.core.arrays import ExtensionArray
@@ -181,7 +183,7 @@ def maybe_downcast_to_dtype(result, dtype: Dtype):
181183
return result
182184

183185

184-
def maybe_downcast_numeric(result, dtype: Dtype, do_round: bool = False):
186+
def maybe_downcast_numeric(result, dtype: DtypeObj, do_round: bool = False):
185187
"""
186188
Subset of maybe_downcast_to_dtype restricted to numeric dtypes.
187189
@@ -325,8 +327,8 @@ def maybe_cast_result_dtype(dtype: DtypeObj, how: str) -> DtypeObj:
325327

326328

327329
def maybe_cast_to_extension_array(
328-
cls: Type["ExtensionArray"], obj, dtype: Dtype = None
329-
):
330+
cls: Type["ExtensionArray"], obj: ArrayLike, dtype: Optional[ExtensionDtype] = None
331+
) -> ArrayLike:
330332
"""
331333
Call to `_from_sequence` that returns the object unchanged on Exception.
332334
@@ -728,7 +730,7 @@ def infer_dtype_from_scalar(val, pandas_dtype: bool = False) -> Tuple[DtypeObj,
728730
# TODO: try to make the Any in the return annotation more specific
729731
def infer_dtype_from_array(
730732
arr, pandas_dtype: bool = False
731-
) -> Tuple[DtypeObj, AnyArrayLike]:
733+
) -> Tuple[DtypeObj, ArrayLike]:
732734
"""
733735
Infer the dtype from an array.
734736
@@ -1018,7 +1020,7 @@ def astype_nansafe(
10181020

10191021
def maybe_convert_objects(
10201022
values: np.ndarray, convert_numeric: bool = True
1021-
) -> Union[np.ndarray, ABCDatetimeIndex]:
1023+
) -> Union[np.ndarray, DatetimeIndex]:
10221024
"""
10231025
If we have an object dtype array, try to coerce dates and/or numbers.
10241026

0 commit comments

Comments
 (0)