Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
f279d16
Some experiments so far
datapythonista Jun 21, 2019
ca5671c
Refactoring of pandas plotting to make the API clearer
datapythonista Jun 23, 2019
8a56ad7
Merge remote-tracking branch 'upstream/master' into plot_api
Jun 25, 2019
196388b
Addressing review comments, and fixing many tests (still some tests f…
Jun 25, 2019
f00ec30
Merge remote-tracking branch 'upstream/master' into plot_api
Jun 25, 2019
1c16faa
Merge remote-tracking branch 'upstream/master' into plot_api
Jun 26, 2019
995d72e
Restoring docstrings of hist_series, hist_frame, boxplot and boxplot_…
Jun 26, 2019
7e45996
Fixing plot accessor docstring (was in the wrong place, and couple of…
Jun 26, 2019
4fbfed0
Fixing hexbin plot tests
Jun 26, 2019
7d7263a
Fixing bug when calling plot twice on the same data, since the data (…
Jun 26, 2019
1a03cbf
Raising missing exception for pie in DataFrame, and fixing accessor s…
Jun 26, 2019
cf7cbc0
Fixing bug that shown the legend for Series plot
Jun 26, 2019
d063e05
Fix linting
Jun 26, 2019
c83551d
Merge remote-tracking branch 'upstream/master' into plot_api
Jun 28, 2019
369fbf1
Merge remote-tracking branch 'upstream/master' into plot_api
Jul 1, 2019
0d146f9
Fixing bug that made reusing the previous plot for dataframes
Jul 1, 2019
34ea1f2
Removing duplicated data type checks
Jul 1, 2019
19489ba
Restoring original position of methods, so the diff is smaller
Jul 1, 2019
9b4fc6d
Fixing name of reuse_plot parameter
Jul 1, 2019
2597bc9
Fixing bug with matplotlib 2
Jul 1, 2019
57c4937
Adding documentation and improving comments, based on Jeff review
Jul 2, 2019
263ee7a
Adding FutureWarning if Series.plot is called with positional arguments
Jul 2, 2019
37fe165
Not passing default matplotlib parameters to backends (all known kwar…
Jul 2, 2019
0cf4514
Fixing test of plotting accessor parameters
Jul 2, 2019
4d70d5d
Temporary not warning for Series.plot positional arguments (looks lik…
Jul 2, 2019
a2330b2
Revert "Temporary not warning for Series.plot positional arguments (l…
Jul 2, 2019
42a1b35
Merge remote-tracking branch 'upstream/master' into plot_api
Jul 2, 2019
34d189f
Adding debug info in the CI for failing test
Jul 2, 2019
5819585
Revert "Adding debug info in the CI for failing test"
Jul 2, 2019
29d7547
Temporary removing the warning, to see if it's causing the andrews_cu…
Jul 2, 2019
37fb064
Merge branch 'master' into PR_TOOL_MERGE_PR_27009
jreback Jul 3, 2019
a5d0fd9
Revert "Temporary removing the warning, to see if it's causing the an…
datapythonista Jul 3, 2019
ce544e1
Removing test that causes parallel_coordinates test to fail
datapythonista Jul 3, 2019
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
Adding FutureWarning if Series.plot is called with positional arguments
  • Loading branch information
Marc Garcia committed Jul 2, 2019
commit 263ee7a43dc1e3bce3daed14df81283d22d7a8aa
18 changes: 13 additions & 5 deletions pandas/plotting/_core.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import importlib
from typing import List, Type # noqa
import warnings

from pandas.util._decorators import Appender

Expand Down Expand Up @@ -518,11 +519,6 @@ def _get_call_args(data, args, kwargs):
signatures, since `DataFramePlotMethods` accepted `x` and `y`
parameters.
"""
if args and isinstance(data, ABCSeries):
# TODO raise warning here, positional arguments shouldn't be
# used anymore, so we can add x, y and kind to the signature
pass

if isinstance(data, ABCSeries):
arg_def = [
('kind', 'line'), ('ax', None), ('figsize', None),
Expand Down Expand Up @@ -550,6 +546,18 @@ def _get_call_args(data, args, kwargs):
'Series or DataFrame').format(
type(data).__name__))

if args and isinstance(data, ABCSeries):
msg = ('`Series.plot()` should not be called with positional '
'arguments, only keyword arguments. The order of '
'positional arguments will change in the future. '
'Use `Series.plot({})` instead of `Series.plot({})`.')
positional_args = str(args)[1:-1]
keyword_args = ', '.join('{}={!r}'.format(name, value)
for (name, default), value
in zip(arg_def, args))
warnings.warn(msg.format(keyword_args, positional_args),
FutureWarning, stacklevel=3)

pos_args = {name: value for value, (name, _) in zip(args, arg_def)}
kwargs = dict(arg_def, **pos_args, **kwargs)

Expand Down
8 changes: 7 additions & 1 deletion pandas/tests/plotting/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import pandas.util._test_decorators as td

from pandas import DataFrame
from pandas import DataFrame, Series
from pandas.tests.plotting.common import TestPlotBase, _check_plot_works
import pandas.util.testing as tm

Expand All @@ -25,6 +25,12 @@ def test_import_error_message():
df.plot()


@td.skip_if_no_mpl
def test_series_plot_with_positional_arguments_warns():
with tm.assert_produces_warning(FutureWarning):
Series([1, 2, 3]).plot('line', None)


@td.skip_if_no_mpl
class TestSeriesPlots(TestPlotBase):

Expand Down