Skip to content

Commit ca0c124

Browse files
simonjayhawkinsKevin D Smith
authored and
Kevin D Smith
committed
TYP: misc fixes for numpy types 2 (pandas-dev#36099)
1 parent 44b225b commit ca0c124

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

pandas/core/dtypes/cast.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,7 @@ def infer_dtype_from_scalar(val, pandas_dtype: bool = False) -> Tuple[DtypeObj,
651651
If False, scalar belongs to pandas extension types is inferred as
652652
object
653653
"""
654-
dtype = np.dtype(object)
654+
dtype: DtypeObj = np.dtype(object)
655655

656656
# a 1-element ndarray
657657
if isinstance(val, np.ndarray):

pandas/core/dtypes/common.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def ensure_str(value: Union[bytes, Any]) -> str:
108108
return value
109109

110110

111-
def ensure_int_or_float(arr: ArrayLike, copy: bool = False) -> np.array:
111+
def ensure_int_or_float(arr: ArrayLike, copy: bool = False) -> np.ndarray:
112112
"""
113113
Ensure that an dtype array of some integer dtype
114114
has an int64 dtype if possible.
@@ -1388,8 +1388,7 @@ def is_bool_dtype(arr_or_dtype) -> bool:
13881388
# guess this
13891389
return arr_or_dtype.is_object and arr_or_dtype.inferred_type == "boolean"
13901390
elif is_extension_array_dtype(arr_or_dtype):
1391-
dtype = getattr(arr_or_dtype, "dtype", arr_or_dtype)
1392-
return dtype._is_boolean
1391+
return getattr(arr_or_dtype, "dtype", arr_or_dtype)._is_boolean
13931392

13941393
return issubclass(dtype.type, np.bool_)
13951394

pandas/core/reshape/merge.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1870,7 +1870,7 @@ def _right_outer_join(x, y, max_groups):
18701870

18711871
def _factorize_keys(
18721872
lk: ArrayLike, rk: ArrayLike, sort: bool = True, how: str = "inner"
1873-
) -> Tuple[np.array, np.array, int]:
1873+
) -> Tuple[np.ndarray, np.ndarray, int]:
18741874
"""
18751875
Encode left and right keys as enumerated types.
18761876

0 commit comments

Comments
 (0)