From 9a496d79704adcaa960527b07781290884a67cef Mon Sep 17 00:00:00 2001 From: jbrockmendel Date: Tue, 19 Nov 2019 15:19:47 -0800 Subject: [PATCH] DEPR: remove tsplot --- doc/source/whatsnew/v1.0.0.rst | 1 + pandas/plotting/__init__.py | 1 - pandas/plotting/_misc.py | 28 ----------- pandas/tests/plotting/test_datetimelike.py | 57 ---------------------- pandas/tseries/plotting.py | 3 -- 5 files changed, 1 insertion(+), 89 deletions(-) delete mode 100644 pandas/tseries/plotting.py diff --git a/doc/source/whatsnew/v1.0.0.rst b/doc/source/whatsnew/v1.0.0.rst index 98d861d999ea9..2de3c83af14d3 100644 --- a/doc/source/whatsnew/v1.0.0.rst +++ b/doc/source/whatsnew/v1.0.0.rst @@ -280,6 +280,7 @@ or ``matplotlib.Axes.plot``. See :ref:`plotting.formatters` for more. - Removed the previously deprecated ``assert_raises_regex`` function in ``pandas.util.testing`` (:issue:`29174`) - Removed :meth:`Index.is_lexsorted_for_tuple` (:issue:`29305`) - Removed support for nexted renaming in :meth:`DataFrame.aggregate`, :meth:`Series.aggregate`, :meth:`DataFrameGroupBy.aggregate`, :meth:`SeriesGroupBy.aggregate`, :meth:`Rolling.aggregate` (:issue:`29608`) +- Removed previously deprecated :func:`pandas.tseries.plotting.tsplot` (:issue:`18627`) - .. _whatsnew_1000.performance: diff --git a/pandas/plotting/__init__.py b/pandas/plotting/__init__.py index ebe047c58b889..55c861e384d67 100644 --- a/pandas/plotting/__init__.py +++ b/pandas/plotting/__init__.py @@ -38,7 +38,6 @@ - hist_series and hist_frame (for `Series.hist` and `DataFrame.hist`) - boxplot (`pandas.plotting.boxplot(df)` equivalent to `DataFrame.boxplot`) - boxplot_frame and boxplot_frame_groupby -- tsplot (deprecated) - register and deregister (register converters for the tick formats) - Plots not called as `Series` and `DataFrame` methods: - table diff --git a/pandas/plotting/_misc.py b/pandas/plotting/_misc.py index 6c8bcdada5957..b8f5a0d83b5c1 100644 --- a/pandas/plotting/_misc.py +++ b/pandas/plotting/_misc.py @@ -1,5 +1,4 @@ from contextlib import contextmanager -import warnings from pandas.util._decorators import deprecate_kwarg @@ -426,33 +425,6 @@ def autocorrelation_plot(series, ax=None, **kwargs): return plot_backend.autocorrelation_plot(series=series, ax=ax, **kwargs) -def tsplot(series, plotf, ax=None, **kwargs): - """ - Plots a Series on the given Matplotlib axes or the current axes - - Parameters - ---------- - axes : Axes - series : Series - - Notes - _____ - Supports same kwargs as Axes.plot - - - .. deprecated:: 0.23.0 - Use Series.plot() instead - """ - warnings.warn( - "'tsplot' is deprecated and will be removed in a " - "future version. Please use Series.plot() instead.", - FutureWarning, - stacklevel=2, - ) - plot_backend = _get_plot_backend("matplotlib") - return plot_backend.tsplot(series=series, plotf=plotf, ax=ax, **kwargs) - - class _Options(dict): """ Stores pandas plotting options. diff --git a/pandas/tests/plotting/test_datetimelike.py b/pandas/tests/plotting/test_datetimelike.py index 973bda8292b2a..f5161b481ca50 100644 --- a/pandas/tests/plotting/test_datetimelike.py +++ b/pandas/tests/plotting/test_datetimelike.py @@ -99,33 +99,12 @@ def test_nonnumeric_exclude(self): with pytest.raises(TypeError, match=msg): df["A"].plot() - def test_tsplot_deprecated(self): - from pandas.tseries.plotting import tsplot - - _, ax = self.plt.subplots() - ts = tm.makeTimeSeries() - - with tm.assert_produces_warning(FutureWarning): - tsplot(ts, self.plt.Axes.plot, ax=ax) - @pytest.mark.slow def test_tsplot(self): - from pandas.tseries.plotting import tsplot - _, ax = self.plt.subplots() ts = tm.makeTimeSeries() - def f(*args, **kwds): - with tm.assert_produces_warning(FutureWarning): - return tsplot(s, self.plt.Axes.plot, *args, **kwds) - - for s in self.period_ser: - _check_plot_works(f, s.index.freq, ax=ax, series=s) - - for s in self.datetime_ser: - _check_plot_works(f, s.index.freq.rule_code, ax=ax, series=s) - for s in self.period_ser: _check_plot_works(s.plot, ax=ax) @@ -194,17 +173,6 @@ def check_format_of_first_point(ax, expected_string): check_format_of_first_point(ax, "t = 2014-01-01 y = 1.000000") tm.close() - # tsplot - from pandas.tseries.plotting import tsplot - - _, ax = self.plt.subplots() - with tm.assert_produces_warning(FutureWarning): - tsplot(annual, self.plt.Axes.plot, ax=ax) - check_format_of_first_point(ax, "t = 2014 y = 1.000000") - with tm.assert_produces_warning(FutureWarning): - tsplot(daily, self.plt.Axes.plot, ax=ax) - check_format_of_first_point(ax, "t = 2014-01-01 y = 1.000000") - @pytest.mark.slow def test_line_plot_period_series(self): for s in self.period_ser: @@ -892,16 +860,6 @@ def test_to_weekly_resampling(self): for l in ax.get_lines(): assert PeriodIndex(data=l.get_xdata()).freq == idxh.freq - _, ax = self.plt.subplots() - from pandas.tseries.plotting import tsplot - - with tm.assert_produces_warning(FutureWarning): - tsplot(high, self.plt.Axes.plot, ax=ax) - with tm.assert_produces_warning(FutureWarning): - lines = tsplot(low, self.plt.Axes.plot, ax=ax) - for l in lines: - assert PeriodIndex(data=l.get_xdata()).freq == idxh.freq - @pytest.mark.slow def test_from_weekly_resampling(self): idxh = date_range("1/1/1999", periods=52, freq="W") @@ -926,21 +884,6 @@ def test_from_weekly_resampling(self): tm.assert_numpy_array_equal(xdata, expected_h) tm.close() - _, ax = self.plt.subplots() - from pandas.tseries.plotting import tsplot - - with tm.assert_produces_warning(FutureWarning): - tsplot(low, self.plt.Axes.plot, ax=ax) - with tm.assert_produces_warning(FutureWarning): - lines = tsplot(high, self.plt.Axes.plot, ax=ax) - for l in lines: - assert PeriodIndex(data=l.get_xdata()).freq == idxh.freq - xdata = l.get_xdata(orig=False) - if len(xdata) == 12: # idxl lines - tm.assert_numpy_array_equal(xdata, expected_l) - else: - tm.assert_numpy_array_equal(xdata, expected_h) - @pytest.mark.slow def test_from_resampling_area_line_mixed(self): idxh = date_range("1/1/1999", periods=52, freq="W") diff --git a/pandas/tseries/plotting.py b/pandas/tseries/plotting.py deleted file mode 100644 index df41b4b5b40d9..0000000000000 --- a/pandas/tseries/plotting.py +++ /dev/null @@ -1,3 +0,0 @@ -# flake8: noqa - -from pandas.plotting._matplotlib.timeseries import tsplot