Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pandas/compat/numpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
_np_version_under1p16 = _nlv < LooseVersion("1.16")
_np_version_under1p17 = _nlv < LooseVersion("1.17")
_np_version_under1p18 = _nlv < LooseVersion("1.18")
_np_version_under1p19 = _nlv < LooseVersion("1.19")
_np_version_under1p20 = _nlv < LooseVersion("1.20")
_is_numpy_dev = ".dev" in str(_nlv)


Expand Down
22 changes: 13 additions & 9 deletions pandas/tests/extension/base/dtype.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,22 @@ def test_check_dtype(self, data):
{"A": pd.Series(data, dtype=dtype), "B": data, "C": "foo", "D": 1}
)

# np.dtype('int64') == 'Int64' == 'int64'
# so can't distinguish
if dtype.name == "Int64":
expected = pd.Series([True, True, False, True], index=list("ABCD"))
else:
expected = pd.Series([True, True, False, False], index=list("ABCD"))

# XXX: This should probably be *fixed* not ignored.
# See libops.scalar_compare
# TODO(numpy-1.20): This warnings filter and if block can be removed
# once we require numpy>=1.20
with warnings.catch_warnings():
warnings.simplefilter("ignore", DeprecationWarning)
result = df.dtypes == str(dtype)
# NumPy>=1.20.0, but not pandas.compat.numpy till there
# is a wheel available with this change.
try:
new_numpy_behavior = np.dtype("int64") != "Int64"
except TypeError:
new_numpy_behavior = True

if dtype.name == "Int64" and not new_numpy_behavior:
expected = pd.Series([True, True, False, True], index=list("ABCD"))
else:
expected = pd.Series([True, True, False, False], index=list("ABCD"))

self.assert_series_equal(result, expected)

Expand Down
6 changes: 5 additions & 1 deletion pandas/tests/plotting/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,17 @@ def test_bootstrap_plot(self):
class TestDataFramePlots(TestPlotBase):
@td.skip_if_no_scipy
def test_scatter_matrix_axis(self):
from pandas.plotting._matplotlib.compat import _mpl_ge_3_0_0

scatter_matrix = plotting.scatter_matrix

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

# we are plotting multiples on a sub-plot
with tm.assert_produces_warning(UserWarning):
with tm.assert_produces_warning(
UserWarning, raise_on_extra_warnings=_mpl_ge_3_0_0()
):
axes = _check_plot_works(
scatter_matrix, filterwarnings="always", frame=df, range_padding=0.1
)
Expand Down