From 7e461a18d9f6928132afec6f48ce968b3e989ba6 Mon Sep 17 00:00:00 2001 From: Kaiqi Dong Date: Mon, 3 Dec 2018 17:43:52 +0100 Subject: [PATCH 01/12] remove \n from docstring --- pandas/core/arrays/datetimes.py | 26 +++++++++++++------------- pandas/core/arrays/timedeltas.py | 16 ++++++++-------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/pandas/core/arrays/datetimes.py b/pandas/core/arrays/datetimes.py index cfe3afcf3730a..b3df505d56d78 100644 --- a/pandas/core/arrays/datetimes.py +++ b/pandas/core/arrays/datetimes.py @@ -82,7 +82,7 @@ def f(self): return result f.__name__ = name - f.__doc__ = docstring + f.__doc__ = "\n{}\n".format(docstring) return property(f) @@ -1072,19 +1072,19 @@ def date(self): return tslib.ints_to_pydatetime(timestamps, box="date") - year = _field_accessor('year', 'Y', "\n The year of the datetime\n") + year = _field_accessor('year', 'Y', "The year of the datetime") month = _field_accessor('month', 'M', - "\n The month as January=1, December=12 \n") - day = _field_accessor('day', 'D', "\nThe days of the datetime\n") - hour = _field_accessor('hour', 'h', "\nThe hours of the datetime\n") - minute = _field_accessor('minute', 'm', "\nThe minutes of the datetime\n") - second = _field_accessor('second', 's', "\nThe seconds of the datetime\n") + "The month as January=1, December=12") + day = _field_accessor('day', 'D', "The days of the datetime") + hour = _field_accessor('hour', 'h', "The hours of the datetime") + minute = _field_accessor('minute', 'm', "The minutes of the datetime") + second = _field_accessor('second', 's', "The seconds of the datetime") microsecond = _field_accessor('microsecond', 'us', - "\nThe microseconds of the datetime\n") + "The microseconds of the datetime") nanosecond = _field_accessor('nanosecond', 'ns', - "\nThe nanoseconds of the datetime\n") + "The nanoseconds of the datetime") weekofyear = _field_accessor('weekofyear', 'woy', - "\nThe week ordinal of the year\n") + "The week ordinal of the year") week = weekofyear _dayofweek_doc = """ The day of the week with Monday=0, Sunday=6. @@ -1129,12 +1129,12 @@ def date(self): "The name of day in a week (ex: Friday)\n\n.. deprecated:: 0.23.0") dayofyear = _field_accessor('dayofyear', 'doy', - "\nThe ordinal day of the year\n") - quarter = _field_accessor('quarter', 'q', "\nThe quarter of the date\n") + "The ordinal day of the year") + quarter = _field_accessor('quarter', 'q', "The quarter of the date") days_in_month = _field_accessor( 'days_in_month', 'dim', - "\nThe number of days in the month\n") + "The number of days in the month") daysinmonth = days_in_month _is_month_doc = """ Indicates whether the date is the {first_or_last} day of the month. diff --git a/pandas/core/arrays/timedeltas.py b/pandas/core/arrays/timedeltas.py index 830283d31a929..4afc9f5483c2a 100644 --- a/pandas/core/arrays/timedeltas.py +++ b/pandas/core/arrays/timedeltas.py @@ -59,7 +59,7 @@ def f(self): return result f.__name__ = name - f.__doc__ = docstring + f.__doc__ = "\n{}\n".format(docstring) return property(f) @@ -684,16 +684,16 @@ def to_pytimedelta(self): return tslibs.ints_to_pytimedelta(self.asi8) days = _field_accessor("days", "days", - "\nNumber of days for each element.\n") + "Number of days for each element.") seconds = _field_accessor("seconds", "seconds", - "\nNumber of seconds (>= 0 and less than 1 day) " - "for each element.\n") + "Number of seconds (>= 0 and less than 1 day) " + "for each element.") microseconds = _field_accessor("microseconds", "microseconds", - "\nNumber of microseconds (>= 0 and less " - "than 1 second) for each element.\n") + "Number of microseconds (>= 0 and less " + "than 1 second) for each element.") nanoseconds = _field_accessor("nanoseconds", "nanoseconds", - "\nNumber of nanoseconds (>= 0 and less " - "than 1 microsecond) for each element.\n") + "Number of nanoseconds (>= 0 and less " + "than 1 microsecond) for each element.") @property def components(self): From dea38f24c0067ae3fe9484b837c9649714213bba Mon Sep 17 00:00:00 2001 From: Kaiqi Date: Tue, 14 Jan 2020 21:26:31 +0100 Subject: [PATCH 02/12] fix issue 17038 --- pandas/core/reshape/pivot.py | 4 +++- pandas/tests/reshape/test_pivot.py | 20 ++++++++++++++------ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/pandas/core/reshape/pivot.py b/pandas/core/reshape/pivot.py index b443ba142369c..9743d90f4dd04 100644 --- a/pandas/core/reshape/pivot.py +++ b/pandas/core/reshape/pivot.py @@ -117,7 +117,9 @@ def pivot_table( agged[v] = maybe_downcast_to_dtype(agged[v], data[v].dtype) table = agged - if table.index.nlevels > 1: + + # GH 17038, this check should only happen if index is specified + if table.index.nlevels > 1 and index: # Related GH #17123 # If index_names are integers, determine whether the integers refer # to the level position or name. diff --git a/pandas/tests/reshape/test_pivot.py b/pandas/tests/reshape/test_pivot.py index 743fc50c87e96..46a05123c9fdd 100644 --- a/pandas/tests/reshape/test_pivot.py +++ b/pandas/tests/reshape/test_pivot.py @@ -896,12 +896,6 @@ def _check_output( totals = table.loc[("All", ""), value_col] assert totals == self.data[value_col].mean() - # no rows - rtable = self.data.pivot_table( - columns=["AA", "BB"], margins=True, aggfunc=np.mean - ) - assert isinstance(rtable, Series) - table = self.data.pivot_table(index=["AA", "BB"], margins=True, aggfunc="mean") for item in ["DD", "EE", "FF"]: totals = table.loc[("All", ""), item] @@ -972,6 +966,20 @@ def test_pivot_integer_columns(self): tm.assert_frame_equal(table, table2, check_names=False) + @pytest.mark.parametrize("cols", [(1, 2), ("a", "b"), (1, "b"), ("a", 1)]) + def test_pivot_table_multiindex_only(self, cols): + # GH 17038 + df2 = DataFrame({cols[0]: [1, 2, 3], cols[1]: [1, 2, 3], "v": [4, 5, 6]}) + + result = df2.pivot_table(values="v", columns=cols) + expected = DataFrame( + [[4, 5, 6]], + columns=MultiIndex.from_tuples([(1, 1), (2, 2), (3, 3)], names=cols), + index=Index(["v"]), + ) + + tm.assert_frame_equal(result, expected) + def test_pivot_no_level_overlap(self): # GH #1181 From cd9e7ac3f31ffaf95cd628863df911dea9fa1248 Mon Sep 17 00:00:00 2001 From: Kaiqi Date: Tue, 14 Jan 2020 21:29:43 +0100 Subject: [PATCH 03/12] revert change --- pandas/core/reshape/pivot.py | 3 +-- pandas/tests/reshape/test_pivot.py | 20 ++++++-------------- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/pandas/core/reshape/pivot.py b/pandas/core/reshape/pivot.py index 9743d90f4dd04..a7cdbb0da7a4e 100644 --- a/pandas/core/reshape/pivot.py +++ b/pandas/core/reshape/pivot.py @@ -118,8 +118,7 @@ def pivot_table( table = agged - # GH 17038, this check should only happen if index is specified - if table.index.nlevels > 1 and index: + if table.index.nlevels > 1: # Related GH #17123 # If index_names are integers, determine whether the integers refer # to the level position or name. diff --git a/pandas/tests/reshape/test_pivot.py b/pandas/tests/reshape/test_pivot.py index 46a05123c9fdd..743fc50c87e96 100644 --- a/pandas/tests/reshape/test_pivot.py +++ b/pandas/tests/reshape/test_pivot.py @@ -896,6 +896,12 @@ def _check_output( totals = table.loc[("All", ""), value_col] assert totals == self.data[value_col].mean() + # no rows + rtable = self.data.pivot_table( + columns=["AA", "BB"], margins=True, aggfunc=np.mean + ) + assert isinstance(rtable, Series) + table = self.data.pivot_table(index=["AA", "BB"], margins=True, aggfunc="mean") for item in ["DD", "EE", "FF"]: totals = table.loc[("All", ""), item] @@ -966,20 +972,6 @@ def test_pivot_integer_columns(self): tm.assert_frame_equal(table, table2, check_names=False) - @pytest.mark.parametrize("cols", [(1, 2), ("a", "b"), (1, "b"), ("a", 1)]) - def test_pivot_table_multiindex_only(self, cols): - # GH 17038 - df2 = DataFrame({cols[0]: [1, 2, 3], cols[1]: [1, 2, 3], "v": [4, 5, 6]}) - - result = df2.pivot_table(values="v", columns=cols) - expected = DataFrame( - [[4, 5, 6]], - columns=MultiIndex.from_tuples([(1, 1), (2, 2), (3, 3)], names=cols), - index=Index(["v"]), - ) - - tm.assert_frame_equal(result, expected) - def test_pivot_no_level_overlap(self): # GH #1181 From e5e912be0f596943067a7df812442764d311a086 Mon Sep 17 00:00:00 2001 From: Kaiqi Date: Tue, 14 Jan 2020 21:30:16 +0100 Subject: [PATCH 04/12] revert change --- pandas/core/reshape/pivot.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pandas/core/reshape/pivot.py b/pandas/core/reshape/pivot.py index a7cdbb0da7a4e..b443ba142369c 100644 --- a/pandas/core/reshape/pivot.py +++ b/pandas/core/reshape/pivot.py @@ -117,7 +117,6 @@ def pivot_table( agged[v] = maybe_downcast_to_dtype(agged[v], data[v].dtype) table = agged - if table.index.nlevels > 1: # Related GH #17123 # If index_names are integers, determine whether the integers refer From d1b97fe82dc93e7339189fa76f6ad371bc303596 Mon Sep 17 00:00:00 2001 From: Kaiqi Date: Sun, 2 Feb 2020 14:44:43 +0100 Subject: [PATCH 05/12] fix ci --- pandas/tests/plotting/test_converter.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/pandas/tests/plotting/test_converter.py b/pandas/tests/plotting/test_converter.py index 9cd3ccbf9214e..a0bcd9a1e3dc2 100644 --- a/pandas/tests/plotting/test_converter.py +++ b/pandas/tests/plotting/test_converter.py @@ -66,9 +66,9 @@ def test_registering_no_warning(self): # Set to the "warn" state, in case this isn't the first test run register_matplotlib_converters() - with tm.assert_produces_warning(DeprecationWarning, check_stacklevel=False): - # GH#30588 DeprecationWarning from 2D indexing - ax.plot(s.index, s.values) + + # GH 30588, after new release of matplotlib, no warning is here + ax.plot(s.index, s.values) def test_pandas_plots_register(self): pytest.importorskip("matplotlib.pyplot") @@ -100,9 +100,8 @@ def test_option_no_warning(self): # Test without registering first, no warning with ctx: - # GH#30588 DeprecationWarning from 2D indexing on Index - with tm.assert_produces_warning(DeprecationWarning, check_stacklevel=False): - ax.plot(s.index, s.values) + # GH#30588 should be no warning after new release + ax.plot(s.index, s.values) # Now test with registering register_matplotlib_converters() From 959c414458a46ad5e60da74ad389b05b05ec18db Mon Sep 17 00:00:00 2001 From: Kaiqi Date: Sun, 2 Feb 2020 14:53:23 +0100 Subject: [PATCH 06/12] fixup --- pandas/tests/plotting/test_converter.py | 26 +++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/pandas/tests/plotting/test_converter.py b/pandas/tests/plotting/test_converter.py index a0bcd9a1e3dc2..3918df331e1db 100644 --- a/pandas/tests/plotting/test_converter.py +++ b/pandas/tests/plotting/test_converter.py @@ -67,8 +67,15 @@ def test_registering_no_warning(self): # Set to the "warn" state, in case this isn't the first test run register_matplotlib_converters() - # GH 30588, after new release of matplotlib, no warning is here - ax.plot(s.index, s.values) + import matplotlib as mpl + + version = mpl.__version__ + if version > "3.1.2": + ax.plot(s.index, s.values) + else: + with tm.assert_produces_warning(DeprecationWarning, check_stacklevel=False): + # GH#30588 DeprecationWarning from 2D indexing + ax.plot(s.index, s.values) def test_pandas_plots_register(self): pytest.importorskip("matplotlib.pyplot") @@ -98,10 +105,21 @@ def test_option_no_warning(self): s = Series(range(12), index=date_range("2017", periods=12)) _, ax = plt.subplots() + import matplotlib as mpl + + version = mpl.__version__ + # Test without registering first, no warning with ctx: - # GH#30588 should be no warning after new release - ax.plot(s.index, s.values) + if version > "3.1.2": + # GH#30588 DeprecationWarning from 2D indexing on Index + with tm.assert_produces_warning( + DeprecationWarning, check_stacklevel=False + ): + ax.plot(s.index, s.values) + else: + # GH#30588 should be no warning after new release + ax.plot(s.index, s.values) # Now test with registering register_matplotlib_converters() From 52ee4cd7060e12a86d7fa12e094e63735d899c4b Mon Sep 17 00:00:00 2001 From: Kaiqi Date: Sun, 2 Feb 2020 15:11:26 +0100 Subject: [PATCH 07/12] add skip decorator --- pandas/tests/plotting/test_converter.py | 28 +++++-------------------- pandas/util/_test_decorators.py | 11 ++++++++++ 2 files changed, 16 insertions(+), 23 deletions(-) diff --git a/pandas/tests/plotting/test_converter.py b/pandas/tests/plotting/test_converter.py index 3918df331e1db..d8eda1efa94eb 100644 --- a/pandas/tests/plotting/test_converter.py +++ b/pandas/tests/plotting/test_converter.py @@ -8,6 +8,7 @@ import pandas._config.config as cf from pandas.compat.numpy import np_datetime64_compat +import pandas.util._test_decorators as td from pandas import Index, Period, Series, Timestamp, date_range import pandas._testing as tm @@ -59,6 +60,7 @@ def test_register_by_default(self): call = [sys.executable, "-c", code] assert subprocess.check_call(call) == 0 + @td.skip_if_low_mpl def test_registering_no_warning(self): plt = pytest.importorskip("matplotlib.pyplot") s = Series(range(12), index=date_range("2017", periods=12)) @@ -66,16 +68,7 @@ def test_registering_no_warning(self): # Set to the "warn" state, in case this isn't the first test run register_matplotlib_converters() - - import matplotlib as mpl - - version = mpl.__version__ - if version > "3.1.2": - ax.plot(s.index, s.values) - else: - with tm.assert_produces_warning(DeprecationWarning, check_stacklevel=False): - # GH#30588 DeprecationWarning from 2D indexing - ax.plot(s.index, s.values) + ax.plot(s.index, s.values) def test_pandas_plots_register(self): pytest.importorskip("matplotlib.pyplot") @@ -98,6 +91,7 @@ def test_matplotlib_formatters(self): assert Timestamp not in units.registry assert Timestamp in units.registry + @td.skip_if_low_mpl def test_option_no_warning(self): pytest.importorskip("matplotlib.pyplot") ctx = cf.option_context("plotting.matplotlib.register_converters", False) @@ -105,21 +99,9 @@ def test_option_no_warning(self): s = Series(range(12), index=date_range("2017", periods=12)) _, ax = plt.subplots() - import matplotlib as mpl - - version = mpl.__version__ - # Test without registering first, no warning with ctx: - if version > "3.1.2": - # GH#30588 DeprecationWarning from 2D indexing on Index - with tm.assert_produces_warning( - DeprecationWarning, check_stacklevel=False - ): - ax.plot(s.index, s.values) - else: - # GH#30588 should be no warning after new release - ax.plot(s.index, s.values) + ax.plot(s.index, s.values) # Now test with registering register_matplotlib_converters() diff --git a/pandas/util/_test_decorators.py b/pandas/util/_test_decorators.py index cd7fdd55a4d2c..60400cb272958 100644 --- a/pandas/util/_test_decorators.py +++ b/pandas/util/_test_decorators.py @@ -120,6 +120,14 @@ def _skip_if_no_scipy() -> bool: ) +def _skip_if_low_mpl(): + # GH 30588 matplotlib after 3.1.2 will no longer raise warning + # from 2D indexing on Index + import matplotlib as mpl + + return LooseVersion(mpl.__version__) <= LooseVersion("3.1.2") + + def skip_if_installed(package: str) -> Callable: """ Skip a test if a package is installed. @@ -194,6 +202,9 @@ def skip_if_no(package: str, min_version: Optional[str] = None) -> Callable: not _USE_NUMEXPR, reason=f"numexpr enabled->{_USE_NUMEXPR}, installed->{_NUMEXPR_INSTALLED}", ) +skip_if_low_mpl = pytest.mark.skipif( + _skip_if_low_mpl(), reason="Matplotlib after 3.1.2 will no longer raise warning" +) def skip_if_np_lt( From 48785769df83907aa62584c302a1a7a5d85164a6 Mon Sep 17 00:00:00 2001 From: Kaiqi Date: Sun, 2 Feb 2020 15:20:52 +0100 Subject: [PATCH 08/12] fixup --- pandas/util/_test_decorators.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/util/_test_decorators.py b/pandas/util/_test_decorators.py index 60400cb272958..9fb621a40585f 100644 --- a/pandas/util/_test_decorators.py +++ b/pandas/util/_test_decorators.py @@ -123,7 +123,7 @@ def _skip_if_no_scipy() -> bool: def _skip_if_low_mpl(): # GH 30588 matplotlib after 3.1.2 will no longer raise warning # from 2D indexing on Index - import matplotlib as mpl + mpl = safe_import("matplotlib") return LooseVersion(mpl.__version__) <= LooseVersion("3.1.2") From c7014a04f663bb21a80703f30d599090da73a36b Mon Sep 17 00:00:00 2001 From: Kaiqi Date: Sun, 2 Feb 2020 15:31:35 +0100 Subject: [PATCH 09/12] fixup --- pandas/util/_test_decorators.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pandas/util/_test_decorators.py b/pandas/util/_test_decorators.py index 9fb621a40585f..a7b015c38774b 100644 --- a/pandas/util/_test_decorators.py +++ b/pandas/util/_test_decorators.py @@ -124,8 +124,7 @@ def _skip_if_low_mpl(): # GH 30588 matplotlib after 3.1.2 will no longer raise warning # from 2D indexing on Index mpl = safe_import("matplotlib") - - return LooseVersion(mpl.__version__) <= LooseVersion("3.1.2") + return mpl and LooseVersion(mpl.__version__) <= LooseVersion("3.1.2") def skip_if_installed(package: str) -> Callable: From fe429546eb5b6482a7b732aba535eef186896d62 Mon Sep 17 00:00:00 2001 From: Kaiqi Date: Sun, 2 Feb 2020 15:51:51 +0100 Subject: [PATCH 10/12] rename --- pandas/tests/plotting/test_converter.py | 7 +++---- pandas/util/_test_decorators.py | 6 +++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/pandas/tests/plotting/test_converter.py b/pandas/tests/plotting/test_converter.py index d8eda1efa94eb..b93a19732ce6e 100644 --- a/pandas/tests/plotting/test_converter.py +++ b/pandas/tests/plotting/test_converter.py @@ -60,7 +60,7 @@ def test_register_by_default(self): call = [sys.executable, "-c", code] assert subprocess.check_call(call) == 0 - @td.skip_if_low_mpl + @td.skip_if_lower_3_1_2_mpl def test_registering_no_warning(self): plt = pytest.importorskip("matplotlib.pyplot") s = Series(range(12), index=date_range("2017", periods=12)) @@ -91,7 +91,7 @@ def test_matplotlib_formatters(self): assert Timestamp not in units.registry assert Timestamp in units.registry - @td.skip_if_low_mpl + @td.skip_if_lower_3_1_2_mpl def test_option_no_warning(self): pytest.importorskip("matplotlib.pyplot") ctx = cf.option_context("plotting.matplotlib.register_converters", False) @@ -106,8 +106,7 @@ def test_option_no_warning(self): # Now test with registering register_matplotlib_converters() with ctx: - with tm.assert_produces_warning(DeprecationWarning, check_stacklevel=False): - ax.plot(s.index, s.values) + ax.plot(s.index, s.values) def test_registry_resets(self): units = pytest.importorskip("matplotlib.units") diff --git a/pandas/util/_test_decorators.py b/pandas/util/_test_decorators.py index a7b015c38774b..86094ab6bc0a8 100644 --- a/pandas/util/_test_decorators.py +++ b/pandas/util/_test_decorators.py @@ -120,7 +120,7 @@ def _skip_if_no_scipy() -> bool: ) -def _skip_if_low_mpl(): +def _skip_if_lower_3_1_2_mpl(): # GH 30588 matplotlib after 3.1.2 will no longer raise warning # from 2D indexing on Index mpl = safe_import("matplotlib") @@ -201,8 +201,8 @@ def skip_if_no(package: str, min_version: Optional[str] = None) -> Callable: not _USE_NUMEXPR, reason=f"numexpr enabled->{_USE_NUMEXPR}, installed->{_NUMEXPR_INSTALLED}", ) -skip_if_low_mpl = pytest.mark.skipif( - _skip_if_low_mpl(), reason="Matplotlib after 3.1.2 will no longer raise warning" +skip_if_lower_3_1_2_mpl = pytest.mark.skipif( + _skip_if_low_3_1_2_mpl(), reason="Matplotlib after 3.1.2 will no longer raise warning" ) From dc0df861f66414a670b21dc67961b99ddadb8b15 Mon Sep 17 00:00:00 2001 From: Kaiqi Date: Sun, 2 Feb 2020 15:52:39 +0100 Subject: [PATCH 11/12] pep8 --- pandas/util/_test_decorators.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pandas/util/_test_decorators.py b/pandas/util/_test_decorators.py index 86094ab6bc0a8..40fbf138583b6 100644 --- a/pandas/util/_test_decorators.py +++ b/pandas/util/_test_decorators.py @@ -202,7 +202,8 @@ def skip_if_no(package: str, min_version: Optional[str] = None) -> Callable: reason=f"numexpr enabled->{_USE_NUMEXPR}, installed->{_NUMEXPR_INSTALLED}", ) skip_if_lower_3_1_2_mpl = pytest.mark.skipif( - _skip_if_low_3_1_2_mpl(), reason="Matplotlib after 3.1.2 will no longer raise warning" + _skip_if_lower_3_1_2_mpl(), + reason="Matplotlib after 3.1.2 will no longer raise warning", ) From 110d63c03237d27fa5f1a47cd9be758a86461336 Mon Sep 17 00:00:00 2001 From: Kaiqi Date: Sun, 2 Feb 2020 17:12:11 +0100 Subject: [PATCH 12/12] simpler --- pandas/tests/plotting/test_converter.py | 4 ++-- pandas/util/_test_decorators.py | 11 ----------- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/pandas/tests/plotting/test_converter.py b/pandas/tests/plotting/test_converter.py index b93a19732ce6e..e54f4784e9c4f 100644 --- a/pandas/tests/plotting/test_converter.py +++ b/pandas/tests/plotting/test_converter.py @@ -60,7 +60,7 @@ def test_register_by_default(self): call = [sys.executable, "-c", code] assert subprocess.check_call(call) == 0 - @td.skip_if_lower_3_1_2_mpl + @td.skip_if_no("matplotlib", min_version="3.1.3") def test_registering_no_warning(self): plt = pytest.importorskip("matplotlib.pyplot") s = Series(range(12), index=date_range("2017", periods=12)) @@ -91,7 +91,7 @@ def test_matplotlib_formatters(self): assert Timestamp not in units.registry assert Timestamp in units.registry - @td.skip_if_lower_3_1_2_mpl + @td.skip_if_no("matplotlib", min_version="3.1.3") def test_option_no_warning(self): pytest.importorskip("matplotlib.pyplot") ctx = cf.option_context("plotting.matplotlib.register_converters", False) diff --git a/pandas/util/_test_decorators.py b/pandas/util/_test_decorators.py index 40fbf138583b6..cd7fdd55a4d2c 100644 --- a/pandas/util/_test_decorators.py +++ b/pandas/util/_test_decorators.py @@ -120,13 +120,6 @@ def _skip_if_no_scipy() -> bool: ) -def _skip_if_lower_3_1_2_mpl(): - # GH 30588 matplotlib after 3.1.2 will no longer raise warning - # from 2D indexing on Index - mpl = safe_import("matplotlib") - return mpl and LooseVersion(mpl.__version__) <= LooseVersion("3.1.2") - - def skip_if_installed(package: str) -> Callable: """ Skip a test if a package is installed. @@ -201,10 +194,6 @@ def skip_if_no(package: str, min_version: Optional[str] = None) -> Callable: not _USE_NUMEXPR, reason=f"numexpr enabled->{_USE_NUMEXPR}, installed->{_NUMEXPR_INSTALLED}", ) -skip_if_lower_3_1_2_mpl = pytest.mark.skipif( - _skip_if_lower_3_1_2_mpl(), - reason="Matplotlib after 3.1.2 will no longer raise warning", -) def skip_if_np_lt(