Skip to content

Commit 9f41ce3

Browse files
committed
update asvs, mypy ignores
1 parent c2691e2 commit 9f41ce3

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

asv_bench/benchmarks/algorithms.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,8 @@ class SortIntegerArray:
199199
params = [10**3, 10**5]
200200

201201
def setup(self, N):
202-
data = np.arange(N, dtype=float)
203-
data[40] = np.nan
202+
data = np.arange(N, dtype=float).astype(object)
203+
data[40] = pd.NA
204204
self.array = pd.array(data, dtype="Int64")
205205

206206
def time_argsort(self, N):

asv_bench/benchmarks/frame_methods.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import numpy as np
55

66
from pandas import (
7+
NA,
78
DataFrame,
89
Index,
910
MultiIndex,
@@ -445,6 +446,8 @@ def setup(self, inplace, dtype):
445446
values[::2] = np.nan
446447
if dtype == "Int64":
447448
values = values.round()
449+
values = values.astype(object)
450+
values[::2] = NA
448451
self.df = DataFrame(values, dtype=dtype)
449452
self.fill_values = self.df.iloc[self.df.first_valid_index()].to_dict()
450453

asv_bench/benchmarks/groupby.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,10 @@ def setup(self, dtype, method, with_nans):
689689
null_vals = vals.astype(float, copy=True)
690690
null_vals[::2, :] = np.nan
691691
null_vals[::3, :] = np.nan
692+
if dtype in ["Int64", "Float64"]:
693+
null_vals = null_vals.astype(object)
694+
null_vals[::2, :] = NA
695+
null_vals[::3, :] = NA
692696
df = DataFrame(null_vals, columns=list("abcde"), dtype=dtype)
693697
df["key"] = keys
694698
self.df = df

pandas/core/algorithms.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,12 +1067,13 @@ def rank(
10671067
is_datetimelike = needs_i8_conversion(values.dtype)
10681068
if (
10691069
isinstance(values.dtype, BaseMaskedDtype)
1070-
and values._hasna
1070+
and values._hasna # type: ignore[union-attr]
10711071
and values.dtype.kind in "iuf"
10721072
):
10731073
# e.g. test_rank_ea_small_values
1074-
# TODO: bug in the object-dtype path that we would get without this special casting.
1075-
values = values.to_numpy(dtype=np.float64, na_value=np.nan)
1074+
# TODO: bug in the object-dtype path that we would get without
1075+
# this special casting.
1076+
values = values.to_numpy(dtype=np.float64, na_value=np.nan) # type: ignore[union-attr]
10761077
else:
10771078
values = _ensure_data(values)
10781079

0 commit comments

Comments
 (0)