-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
CI: unpin numpy for CI / Checks github action #36092
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 43 commits
de92c4e
3ff2a13
da38df6
960fc4f
93e1499
70f0469
c7e24a4
ad3b8fd
f2ae4db
9c332b7
b2e4d50
a0bae1b
b74ea13
911390e
02588b3
04ab966
0fac404
7dc3f7b
003bc91
e449a10
0539f9f
6113fdd
fe770ba
6387978
5817ba2
8423bf4
4766533
bd8594f
aa3e89a
578c30a
75a2d35
2cb4290
87b4e2a
e7d5c08
eed821d
22020e0
25a5573
f766989
28e7446
d597f89
5192865
ae8a491
f4d4c13
3b5ce27
d2514c6
5d55636
1473ae9
7ee319f
4445f6d
5d508ab
3b75658
7b1d8df
582ecd3
0319d75
494b9f2
e28c09f
ca3634a
1361e7f
86a5dcd
133095d
fdba338
155a150
0bf1790
0e7f160
f95dda6
ffb91f3
be7b8b9
3bce00c
51c7570
37001d5
9a0dab2
3da2a67
7947154
a309f4f
6df88fd
c031007
6abff15
49319a8
13e6298
3a87d8c
be0f170
ed5b61a
8736f6c
765687e
d9ca512
2f8a14f
8472d94
21c143b
4068a38
d078f6e
50bf741
05896e9
a654494
cbd382d
edb5e46
768887a
32d877f
810a937
93ae757
7f38d0b
be52c33
466a8b0
f45efe6
1bb6eff
28eabd5
d9d079c
05d604a
c3f84e3
814ba4d
be6f667
7834a8a
763f0e9
4b1b3b0
fb495b6
decbbd6
dd38e44
a9cf1a3
9be8b00
09f07f1
e938438
9381f84
50f64fa
bbeca86
478aeee
f4b92eb
567d1d0
f769626
6521d91
ec2d0ad
9184c99
57bb406
f212c3d
2cfd5a7
6ec2f56
d596b03
1c51c74
f848225
81966ec
e68c42d
a4c4aa3
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 |
---|---|---|
|
@@ -151,14 +151,20 @@ def _ensure_data( | |
# TODO(EA2D): special case not needed with 2D EAs | ||
asi8 = values.view("i8") | ||
dtype = values.dtype | ||
return asi8, dtype | ||
# error: Incompatible return value type (got "Tuple[Any, | ||
# Union[dtype, ExtensionDtype, None]]", expected | ||
# "Tuple[ndarray, Union[dtype, ExtensionDtype]]") | ||
return asi8, dtype # type: ignore[return-value] | ||
|
||
from pandas import DatetimeIndex | ||
|
||
values = DatetimeIndex(values) | ||
dtype = values.dtype | ||
|
||
return values.asi8, dtype | ||
# error: Incompatible return value type (got "Tuple[Any, Union[dtype, | ||
# ExtensionDtype, None]]", expected "Tuple[ndarray, Union[dtype, | ||
# ExtensionDtype]]") | ||
return values.asi8, dtype # type: ignore[return-value] | ||
|
||
elif is_categorical_dtype(vals_dtype) and ( | ||
is_categorical_dtype(dtype) or dtype is None | ||
|
@@ -194,20 +200,37 @@ def _reconstruct_data( | |
ExtensionArray or np.ndarray | ||
""" | ||
if is_extension_array_dtype(dtype): | ||
values = dtype.construct_array_type()._from_sequence(values) | ||
# error: Item "dtype" of "Union[dtype, ExtensionDtype]" has no | ||
# attribute "construct_array_type" | ||
tmp = dtype.construct_array_type() # type: ignore[union-attr] | ||
values = tmp._from_sequence(values) | ||
elif is_bool_dtype(dtype): | ||
values = values.astype(dtype, copy=False) | ||
# error: Argument 1 to "astype" of "_ArrayOrScalarCommon" has | ||
# incompatible type "Union[dtype, ExtensionDtype]"; expected | ||
# "Union[dtype, None, type, _SupportsDtype, str, Tuple[Any, int], | ||
# Tuple[Any, Union[int, Sequence[int]]], List[Any], _DtypeDict, | ||
# Tuple[Any, Any]]" | ||
values = values.astype(dtype, copy=False) # type: ignore[arg-type] | ||
|
||
# we only support object dtypes bool Index | ||
if isinstance(original, ABCIndexClass): | ||
values = values.astype(object, copy=False) | ||
elif dtype is not None: | ||
if is_datetime64_dtype(dtype): | ||
dtype = "datetime64[ns]" | ||
# error: Incompatible types in assignment (expression has type | ||
# "str", variable has type "Union[dtype, ExtensionDtype]") | ||
dtype = "datetime64[ns]" # type: ignore[assignment] | ||
elif is_timedelta64_dtype(dtype): | ||
dtype = "timedelta64[ns]" | ||
# error: Incompatible types in assignment (expression has type | ||
# "str", variable has type "Union[dtype, ExtensionDtype]") | ||
dtype = "timedelta64[ns]" # type: ignore[assignment] | ||
|
||
values = values.astype(dtype, copy=False) | ||
# error: Argument 1 to "astype" of "_ArrayOrScalarCommon" has | ||
# incompatible type "Union[dtype, ExtensionDtype]"; expected | ||
# "Union[dtype, None, type, _SupportsDtype, str, Tuple[Any, int], | ||
# Tuple[Any, Union[int, Sequence[int]]], List[Any], _DtypeDict, | ||
# Tuple[Any, Any]]" | ||
values = values.astype(dtype, copy=False) # type: ignore[arg-type] | ||
|
||
return values | ||
|
||
|
@@ -421,17 +444,60 @@ def isin(comps: AnyArrayLike, values: AnyArrayLike) -> np.ndarray: | |
) | ||
|
||
if not isinstance(values, (ABCIndex, ABCSeries, ABCExtensionArray, np.ndarray)): | ||
values = construct_1d_object_array_from_listlike(list(values)) | ||
# pandas\core\algorithms.py:424: error: Incompatible types in | ||
# assignment (expression has type "ndarray", variable has type | ||
# "ExtensionArray") [assignment] | ||
|
||
# pandas\core\algorithms.py:424: error: Incompatible types in | ||
# assignment (expression has type "ndarray", variable has type "Index") | ||
# [assignment] | ||
|
||
# pandas\core\algorithms.py:424: error: Incompatible types in | ||
# assignment (expression has type "ndarray", variable has type | ||
# "Series") [assignment] | ||
values = construct_1d_object_array_from_listlike( # type: ignore[assignment] | ||
list(values) | ||
) | ||
# TODO: could use ensure_arraylike here | ||
|
||
comps = extract_array(comps, extract_numpy=True) | ||
# pandas\core\algorithms.py:457: error: Incompatible types in assignment | ||
# (expression has type "ExtensionArray", variable has type "Index") | ||
# [assignment] | ||
|
||
# pandas\core\algorithms.py:457: error: Incompatible types in assignment | ||
# (expression has type "ExtensionArray", variable has type "Series") | ||
# [assignment] | ||
|
||
# pandas\core\algorithms.py:457: error: Incompatible types in assignment | ||
# (expression has type "ExtensionArray", variable has type "ndarray") | ||
# [assignment] | ||
comps = extract_array(comps, extract_numpy=True) # type: ignore[assignment] | ||
if is_categorical_dtype(comps): | ||
# TODO(extension) | ||
# handle categoricals | ||
return cast("Categorical", comps).isin(values) | ||
|
||
comps, dtype = _ensure_data(comps) | ||
values, _ = _ensure_data(values, dtype=dtype) | ||
# pandas\core\algorithms.py:463: error: Incompatible types in assignment | ||
# (expression has type "ndarray", variable has type "ExtensionArray") | ||
# [assignment] | ||
|
||
# pandas\core\algorithms.py:463: error: Incompatible types in assignment | ||
# (expression has type "ndarray", variable has type "Index") [assignment] | ||
|
||
# pandas\core\algorithms.py:463: error: Incompatible types in assignment | ||
# (expression has type "ndarray", variable has type "Series") [assignment] | ||
comps, dtype = _ensure_data(comps) # type: ignore[assignment] | ||
|
||
# pandas\core\algorithms.py:490: error: Incompatible types in assignment | ||
# (expression has type "ndarray", variable has type "ExtensionArray") | ||
# [assignment] | ||
|
||
# pandas\core\algorithms.py:490: error: Incompatible types in assignment | ||
# (expression has type "ndarray", variable has type "Index") [assignment] | ||
|
||
# pandas\core\algorithms.py:490: error: Incompatible types in assignment | ||
# (expression has type "ndarray", variable has type "Series") [assignment] | ||
values, _ = _ensure_data(values, dtype=dtype) # type: ignore[assignment] | ||
|
||
# faster for larger cases to use np.in1d | ||
f = htable.ismember_object | ||
|
@@ -1114,7 +1180,9 @@ def _get_score(at): | |
else: | ||
q = np.asarray(q, np.float64) | ||
result = [_get_score(x) for x in q] | ||
result = np.array(result, dtype=np.float64) | ||
# error: Incompatible types in assignment (expression has type | ||
# "ndarray", variable has type "List[Any]") | ||
result = np.array(result, dtype=np.float64) # type: ignore[assignment] | ||
return result | ||
|
||
|
||
|
@@ -1187,14 +1255,24 @@ def compute(self, method: str) -> Series: | |
# fast method | ||
arr, pandas_dtype = _ensure_data(dropped.values) | ||
if method == "nlargest": | ||
arr = -arr | ||
# pandas\core\algorithms.py:1264: error: Incompatible types in | ||
# assignment (expression has type "Union[ndarray, generic]", | ||
# variable has type "ndarray") [assignment] | ||
arr = -arr # type: ignore[assignment] | ||
if is_integer_dtype(pandas_dtype): | ||
# GH 21426: ensure reverse ordering at boundaries | ||
arr -= 1 | ||
|
||
elif is_bool_dtype(pandas_dtype): | ||
# GH 26154: ensure False is smaller than True | ||
arr = 1 - (-arr) | ||
|
||
# pandas\core\algorithms.py:1269: error: Incompatible types in | ||
# assignment (expression has type "Union[ndarray, generic]", | ||
# variable has type "ndarray") [assignment] | ||
|
||
# pandas\core\algorithms.py:1275: error: Unsupported operand | ||
# types for - ("int" and "generic") [operator] | ||
arr = 1 - (-arr) # type: ignore[assignment,operator] | ||
|
||
if self.keep == "last": | ||
arr = arr[::-1] | ||
|
@@ -2136,7 +2214,9 @@ def _sort_mixed(values): | |
return np.concatenate([nums, np.asarray(strs, dtype=object)]) | ||
|
||
|
||
def _sort_tuples(values: np.ndarray[tuple]): | ||
# pandas\core\algorithms.py:2217: error: "ndarray" expects no type arguments, | ||
# but 1 given [type-arg] | ||
def _sort_tuples(values: np.ndarray[tuple]): # type: ignore[type-arg] | ||
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. IIUC np.ndarray takes annotations of the form 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. ndarray doesn't take type arguments (is not a generic type). so this just needs to be changed to just 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. opened #39792 |
||
""" | ||
Convert array of tuples (1d) to array or array (2d). | ||
We need to keep the columns separately as they contain different types and | ||
|
Uh oh!
There was an error while loading. Please reload this page.