diff --git a/upsetplot/data.py b/upsetplot/data.py index 7080332..7fa6eb5 100644 --- a/upsetplot/data.py +++ b/upsetplot/data.py @@ -1,7 +1,5 @@ from __future__ import print_function, division, absolute_import from numbers import Number -import functools -from distutils.version import LooseVersion import warnings import pandas as pd @@ -385,12 +383,7 @@ def from_contents(contents, data=None, id_column="id"): if not all(s.index.is_unique for s in cat_series): raise ValueError("Got duplicate ids in a category") - concat = pd.concat - if LooseVersion(pd.__version__) >= "0.23.0": - # silence the warning - concat = functools.partial(concat, sort=False) - - df = concat(cat_series, axis=1) + df = pd.concat(cat_series, axis=1, sort=False) if id_column in df.columns: raise ValueError("A category cannot be named %r" % id_column) df.fillna(False, inplace=True) @@ -408,6 +401,6 @@ def from_contents(contents, data=None, id_column="id"): "data: %r" % not_in_data.index.values ) df = df.reindex(index=data.index).fillna(False) - df = concat([data, df], axis=1) + df = pd.concat([data, df], axis=1, sort=False) df.index.name = id_column return df.reset_index().set_index(cat_names) diff --git a/upsetplot/plotting.py b/upsetplot/plotting.py index 1686251..e71727a 100644 --- a/upsetplot/plotting.py +++ b/upsetplot/plotting.py @@ -1,6 +1,7 @@ from __future__ import print_function, division, absolute_import import typing +import warnings import numpy as np import pandas as pd @@ -648,13 +649,17 @@ def make_grid(self, fig=None): ) window_extent_args = {} if RENDERER_IMPORTED: - window_extent_args["renderer"] = get_renderer(fig) + with warnings.catch_warnings(): + warnings.simplefilter("ignore", DeprecationWarning) + window_extent_args["renderer"] = get_renderer(fig) textw = t.get_window_extent(**window_extent_args).width t.remove() window_extent_args = {} if RENDERER_IMPORTED: - window_extent_args["renderer"] = get_renderer(fig) + with warnings.catch_warnings(): + warnings.simplefilter("ignore", DeprecationWarning) + window_extent_args["renderer"] = get_renderer(fig) figw = self._reorient(fig.get_window_extent(**window_extent_args)).width sizes = np.asarray([p["elements"] for p in self._subset_plots]) diff --git a/upsetplot/tests/test_data.py b/upsetplot/tests/test_data.py index c6146e6..80d8142 100644 --- a/upsetplot/tests/test_data.py +++ b/upsetplot/tests/test_data.py @@ -2,7 +2,6 @@ import pytest import pandas as pd import numpy as np -from distutils.version import LooseVersion from pandas.testing import assert_series_equal, assert_frame_equal, assert_index_equal from upsetplot import from_memberships, from_contents, from_indicators, generate_data @@ -71,8 +70,7 @@ def test_from_memberships_with_data(data, ndim): assert out is not data # make sure frame is copied if hasattr(data, "loc") and np.asarray(data).dtype.kind in "ifb": # but not deepcopied when possible - if LooseVersion(pd.__version__) > LooseVersion("0.35"): - assert out.values.base is np.asarray(data).base + assert out.values.base is np.asarray(data).base if ndim == 1: assert isinstance(out, pd.Series) else: