Skip to content

Commit 595d2c3

Browse files
WillAydsimonjayhawkins
authored andcommitted
Backport PR pandas-dev#34721 on branch 1.0.x (Debug CI Issue)
1 parent 29edbab commit 595d2c3

File tree

3 files changed

+20
-10
lines changed

3 files changed

+20
-10
lines changed

pandas/compat/numpy/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
_np_version_under1p16 = _nlv < LooseVersion("1.16")
1414
_np_version_under1p17 = _nlv < LooseVersion("1.17")
1515
_np_version_under1p18 = _nlv < LooseVersion("1.18")
16+
_np_version_under1p19 = _nlv < LooseVersion("1.19")
17+
_np_version_under1p20 = _nlv < LooseVersion("1.20")
1618
_is_numpy_dev = ".dev" in str(_nlv)
1719

1820

pandas/tests/extension/base/dtype.py

+13-9
Original file line numberDiff line numberDiff line change
@@ -68,18 +68,22 @@ def test_check_dtype(self, data):
6868
{"A": pd.Series(data, dtype=dtype), "B": data, "C": "foo", "D": 1}
6969
)
7070

71-
# np.dtype('int64') == 'Int64' == 'int64'
72-
# so can't distinguish
73-
if dtype.name == "Int64":
74-
expected = pd.Series([True, True, False, True], index=list("ABCD"))
75-
else:
76-
expected = pd.Series([True, True, False, False], index=list("ABCD"))
77-
78-
# XXX: This should probably be *fixed* not ignored.
79-
# See libops.scalar_compare
71+
# TODO(numpy-1.20): This warnings filter and if block can be removed
72+
# once we require numpy>=1.20
8073
with warnings.catch_warnings():
8174
warnings.simplefilter("ignore", DeprecationWarning)
8275
result = df.dtypes == str(dtype)
76+
# NumPy>=1.20.0, but not pandas.compat.numpy till there
77+
# is a wheel available with this change.
78+
try:
79+
new_numpy_behavior = np.dtype("int64") != "Int64"
80+
except TypeError:
81+
new_numpy_behavior = True
82+
83+
if dtype.name == "Int64" and not new_numpy_behavior:
84+
expected = pd.Series([True, True, False, True], index=list("ABCD"))
85+
else:
86+
expected = pd.Series([True, True, False, False], index=list("ABCD"))
8387

8488
self.assert_series_equal(result, expected)
8589

pandas/tests/plotting/test_misc.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,17 @@ def test_bootstrap_plot(self):
9898
class TestDataFramePlots(TestPlotBase):
9999
@td.skip_if_no_scipy
100100
def test_scatter_matrix_axis(self):
101+
from pandas.plotting._matplotlib.compat import _mpl_ge_3_0_0
102+
101103
scatter_matrix = plotting.scatter_matrix
102104

103105
with tm.RNGContext(42):
104106
df = DataFrame(randn(100, 3))
105107

106108
# we are plotting multiples on a sub-plot
107-
with tm.assert_produces_warning(UserWarning):
109+
with tm.assert_produces_warning(
110+
UserWarning, raise_on_extra_warnings=_mpl_ge_3_0_0()
111+
):
108112
axes = _check_plot_works(
109113
scatter_matrix, filterwarnings="always", frame=df, range_padding=0.1
110114
)

0 commit comments

Comments
 (0)