-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Replaced np.bool refs; fix CI failure #34835
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
Changes from 7 commits
0795f80
c42778a
131a894
2c2517b
aaf14fa
6870d19
f29ef6e
af1b945
7ed2e41
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ cdef NUMERIC_TYPES = ( | |
bool, | ||
int, | ||
float, | ||
np.bool, | ||
np.bool_, | ||
np.int8, | ||
np.int16, | ||
np.int32, | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -225,7 +225,7 @@ def trans(x): | |||||
# if we have any nulls, then we are done | ||||||
return result | ||||||
|
||||||
elif not isinstance(r[0], (np.integer, np.floating, np.bool, int, float, bool)): | ||||||
elif not isinstance(r[0], (np.integer, np.floating, int, float, bool)): | ||||||
# a comparable, e.g. a Decimal may slip in here | ||||||
return result | ||||||
|
||||||
|
@@ -315,7 +315,7 @@ def maybe_cast_result_dtype(dtype: DtypeObj, how: str) -> DtypeObj: | |||||
from pandas.core.arrays.boolean import BooleanDtype | ||||||
from pandas.core.arrays.integer import Int64Dtype | ||||||
|
||||||
if how in ["add", "cumsum", "sum"] and (dtype == np.dtype(np.bool)): | ||||||
if how in ["add", "cumsum", "sum"] and (dtype == np.dtype(bool)): | ||||||
return np.dtype(np.int64) | ||||||
elif how in ["add", "cumsum", "sum"] and isinstance(dtype, BooleanDtype): | ||||||
return Int64Dtype() | ||||||
|
@@ -597,7 +597,7 @@ def _ensure_dtype_type(value, dtype): | |||||
""" | ||||||
Ensure that the given value is an instance of the given dtype. | ||||||
|
||||||
e.g. if out dtype is np.complex64, we should have an instance of that | ||||||
e.g. if out dtype is np.complex64_, we should have an instance of that | ||||||
as opposed to a python complex object. | ||||||
|
||||||
Parameters | ||||||
|
@@ -1483,7 +1483,7 @@ def find_common_type(types: List[DtypeObj]) -> DtypeObj: | |||||
if has_bools: | ||||||
for t in types: | ||||||
if is_integer_dtype(t) or is_float_dtype(t) or is_complex_dtype(t): | ||||||
return np.object | ||||||
return object | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
(to ensure this function actually returns a dtype object, as its type annotation indicates) |
||||||
|
||||||
return np.find_common_type(types, []) | ||||||
|
||||||
|
@@ -1742,7 +1742,7 @@ def validate_numeric_casting(dtype: np.dtype, value): | |||||
if is_float(value) and np.isnan(value): | ||||||
raise ValueError("Cannot assign nan to integer series") | ||||||
|
||||||
if issubclass(dtype.type, (np.integer, np.floating, np.complex)) and not issubclass( | ||||||
if issubclass(dtype.type, (np.integer, np.floating, complex)) and not issubclass( | ||||||
dtype.type, np.bool_ | ||||||
): | ||||||
if is_bool(value): | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -264,7 +264,7 @@ def hash_array( | |
|
||
# First, turn whatever array this is into unsigned 64-bit ints, if we can | ||
# manage it. | ||
elif isinstance(dtype, np.bool): | ||
elif isinstance(dtype, bool): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure if this can ever be correct:
unless |
||
vals = vals.astype("u8") | ||
elif issubclass(dtype.type, (np.datetime64, np.timedelta64)): | ||
vals = vals.view("i8").astype("u8", copy=False) | ||
|
Uh oh!
There was an error while loading. Please reload this page.