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

API: Restore implicit converter registration #18307

Merged
merged 26 commits into from
Dec 7, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
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
Prev Previous commit
Next Next commit
fixup! Remove matplotlib from blacklist
  • Loading branch information
TomAugspurger committed Nov 15, 2017
commit ba88a043a13531f064db2705dc51aac70023c55c
9 changes: 5 additions & 4 deletions doc/source/whatsnew/v0.21.1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ the converter.

This caused problems for some users, so we're temporarily reverting that change;
pandas will again register the converters on import. Using the converters
without explicitly registering the formatters will cause a ``FutureWarning``:
without explicitly registering the converters will cause a ``FutureWarning``:

.. code-block:: python

Expand All @@ -42,9 +42,10 @@ without explicitly registering the formatters will cause a ``FutureWarning``:
>>> from pandas.tseries import converter
>>> converter.register()

As the error message says, you'll need to register the converts if you intend to
use them with matplotlib plotting functions. Pandas plotting functions, such as
``Series.plot``, will register them for you. (:issue:`18301`)
As the error message says, you'll need to register the converters if you intend
to use them with matplotlib plotting functions. Pandas plotting functions, such
as ``Series.plot``, will register them for you calling ``converter.register()``
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"for you calling" -> "for you, and calling"

first is not necessary. (:issue:`18301`)

.. _whatsnew_0211.enhancements:

Expand Down
7 changes: 4 additions & 3 deletions pandas/plotting/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2059,7 +2059,7 @@ def boxplot_frame(self, column=None, by=None, ax=None, fontsize=None, rot=0,
grid=True, figsize=None, layout=None,
return_type=None, **kwds):
import matplotlib.pyplot as plt
_converter.WARN = False
_converter._WARN = False
ax = boxplot(self, column=column, by=by, ax=ax, fontsize=fontsize,
grid=grid, rot=rot, figsize=figsize, layout=layout,
return_type=return_type, **kwds)
Expand Down Expand Up @@ -2155,7 +2155,7 @@ def hist_frame(data, column=None, by=None, grid=True, xlabelsize=None,
kwds : other plotting keyword arguments
To be passed to hist function
"""
_converter.WARN = False
_converter._WARN = False
if by is not None:
axes = grouped_hist(data, column=column, by=by, ax=ax, grid=grid,
figsize=figsize, sharex=sharex, sharey=sharey,
Expand Down Expand Up @@ -2289,7 +2289,7 @@ def grouped_hist(data, column=None, by=None, ax=None, bins=50, figsize=None,
-------
axes: collection of Matplotlib Axes
"""
_converter.WARN = False
_converter._WARN = False

def plot_group(group, ax):
ax.hist(group.dropna().values, bins=bins, **kwargs)
Expand Down Expand Up @@ -2354,6 +2354,7 @@ def boxplot_frame_groupby(grouped, subplots=True, column=None, fontsize=None,
>>> grouped = df.unstack(level='lvl1').groupby(level=0, axis=1)
>>> boxplot_frame_groupby(grouped, subplots=False)
"""
_converter._WARN = False
if subplots is True:
naxes = len(grouped)
fig, axes = _subplots(naxes=naxes, squeeze=False,
Expand Down
10 changes: 10 additions & 0 deletions pandas/tests/plotting/test_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,16 @@ def test_registering_no_warning(self):

assert len(w) == 0

def test_pandas_plots_register(self):
pytest.importorskip("matplotlib.pyplot")
s = Series(range(12), index=date_range('2017', periods=12))
# Set to the "no-warn" state, in case this isn't the first test run
converter._WARN = True
with tm.assert_produces_warning(None) as w:
s.plot()

assert len(w) == 0


class TestDateTimeConverter(object):

Expand Down
35 changes: 0 additions & 35 deletions pandas/tests/plotting/test_warns.py

This file was deleted.