Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLN: deprecate the pandas.tseries.plotting.tsplot function (GH18627) #19980

Merged
merged 1 commit into from
Mar 6, 2018
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 doc/source/whatsnew/v0.23.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,8 @@ Deprecations
- The ``order`` parameter of :func:`factorize` is deprecated and will be removed in a future release (:issue:`19727`)
- :attr:`Timestamp.weekday_name`, :attr:`DatetimeIndex.weekday_name`, and :attr:`Series.dt.weekday_name` are deprecated in favor of :meth:`Timestamp.day_name`, :meth:`DatetimeIndex.day_name`, and :meth:`Series.dt.day_name` (:issue:`12806`)

- ``pandas.tseries.plotting.tsplot`` is deprecated. Use :func:`Series.plot` instead (:issue:`18627`)

.. _whatsnew_0230.prior_deprecations:

Removal of prior version deprecations/changes
Expand Down
8 changes: 8 additions & 0 deletions pandas/plotting/_timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@


def tsplot(series, plotf, ax=None, **kwargs):
import warnings
"""
Plots a Series on the given Matplotlib axes or the current axes

Expand All @@ -35,7 +36,14 @@ def tsplot(series, plotf, ax=None, **kwargs):
_____
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)

# Used inferred freq is possible, need a test case for inferred
if ax is None:
import matplotlib.pyplot as plt
Expand Down
9 changes: 9 additions & 0 deletions pandas/tests/plotting/test_datetimelike.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,15 @@ def test_nonnumeric_exclude(self):

pytest.raises(TypeError, 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
Expand Down