Skip to content

Allow list-like for y in DataFrame.plot. #19699

Closed
@TomAugspurger

Description

@TomAugspurger

In pandas 0.22 and earlier, we passing multiple values for y worked by accident. The code clearly assumed that y was a scalar, but things usually worked, perhaps with an incidental warning:

In [12]: df = pd.DataFrame(np.random.uniform(size=(10, 2)), columns=['a', 'b'])

In [15]: df.plot(x='c', y=['a', 'b'])
/Users/taugspurger/miniconda3/envs/pandas-0.21.0/lib/python3.6/site-packages/pandas/plotting/_core.py:1714: UserWarning: Pandas doesn't allow columns to be created via a new attribute name - see https://pandas.pydata.org/pandas-docs/stable/indexing.html#attribute-access
  series.name = label
Out[15]: <matplotlib.axes._subplots.AxesSubplot at 0x10f83b198>

On master, this will currently raise. I think that we should explicitly support list-likes for y.

Tagging for 0.23 since I think this should be a blocker.

xref #18695 where we made the change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions