Skip to content

TYP: misc fixes for numpy types 2 #36099

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pandas/core/dtypes/cast.py
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ def infer_dtype_from_scalar(val, pandas_dtype: bool = False) -> Tuple[DtypeObj,
If False, scalar belongs to pandas extension types is inferred as
object
"""
dtype = np.dtype(object)
dtype: DtypeObj = np.dtype(object)

# a 1-element ndarray
if isinstance(val, np.ndarray):
Expand Down
5 changes: 2 additions & 3 deletions pandas/core/dtypes/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def ensure_str(value: Union[bytes, Any]) -> str:
return value


def ensure_int_or_float(arr: ArrayLike, copy: bool = False) -> np.array:
def ensure_int_or_float(arr: ArrayLike, copy: bool = False) -> np.ndarray:
"""
Ensure that an dtype array of some integer dtype
has an int64 dtype if possible.
Expand Down Expand Up @@ -1388,8 +1388,7 @@ def is_bool_dtype(arr_or_dtype) -> bool:
# guess this
return arr_or_dtype.is_object and arr_or_dtype.inferred_type == "boolean"
elif is_extension_array_dtype(arr_or_dtype):
dtype = getattr(arr_or_dtype, "dtype", arr_or_dtype)
return dtype._is_boolean
return getattr(arr_or_dtype, "dtype", arr_or_dtype)._is_boolean

return issubclass(dtype.type, np.bool_)

Expand Down
2 changes: 1 addition & 1 deletion pandas/core/reshape/merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -1870,7 +1870,7 @@ def _right_outer_join(x, y, max_groups):

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

Expand Down