Skip to content

Commit fd2ba65

Browse files
committed
fix ci
1 parent 7e0649f commit fd2ba65

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

pandas/core/nanops.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
npt,
3333
)
3434
from pandas.compat._optional import import_optional_dependency
35+
from pandas.compat.numpy import np_version_gt2
3536

3637
from pandas.core.dtypes.common import (
3738
is_complex,
@@ -155,7 +156,7 @@ def _bn_ok_dtype(dtype: DtypeObj, name: str) -> bool:
155156
# Bottleneck chokes on datetime64, PeriodDtype (or and EA)
156157
if (
157158
dtype != object
158-
and dtype != np.dtypes.StringDType(na_object=libmissing.NA)
159+
and (np_version_gt2 and dtype != np.dtypes.StringDType(na_object=libmissing.NA))
159160
and not needs_i8_conversion(dtype)
160161
):
161162
# GH 42878

pandas/tests/indexes/test_numpy_compat.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ def test_numpy_ufuncs_other(index, func):
124124
with tm.external_error_raised(TypeError):
125125
func(index)
126126

127+
elif index.dtype == "string[python]" and func is np.isnan:
128+
with tm.external_error_raised(ValueError):
129+
func(index)
130+
127131
elif is_numeric_dtype(index) and not (
128132
is_complex_dtype(index) and func is np.signbit
129133
):

pandas/tests/series/test_reductions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,10 @@ def test_mean_dont_convert_j_to_complex():
191191
with pytest.raises(TypeError, match=msg):
192192
df.agg("mean")
193193

194-
msg = "Could not convert string 'J' to numeric|does not support"
194+
msg = "Could not convert string 'J' to numeric|does not support|Cannot pass"
195195
with pytest.raises(TypeError, match=msg):
196196
df["db"].mean()
197-
msg = "Could not convert string 'J' to numeric|ufunc 'divide'"
197+
msg = "Could not convert string 'J' to numeric|ufunc 'divide'|Cannot pass"
198198
with pytest.raises(TypeError, match=msg):
199199
np.mean(df["db"].astype("string").array)
200200

0 commit comments

Comments
 (0)