API & BUG: allow list-like y argument to df.plot & fix integer arg to x,y
State: closed

- [x] closes #19699
- [x] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry

@TomAugspurger 

I added support for the user to pass a list-like to y, as discussed in #19699. The API to `df.plot` is relatively complex with lots of args, so lmk with questions / fdbck. Not sure if I covered everything for docs.


Labels:
name: Visualization
description: plotting
name: Regression
description: Functionality that used to work in a prior pandas version

Comments:
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/20000?src=pr&el=h1) Report
> Merging [#20000](https://codecov.io/gh/pandas-dev/pandas/pull/20000?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/7273ea0709590e6264607f227bb8def0ef656c50?src=pr&el=desc) will **increase** coverage by `0.03%`.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/20000/graphs/tree.svg?src=pr&height=150&width=650&token=eZ4WkYLtcO)](https://codecov.io/gh/pandas-dev/pandas/pull/20000?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #20000      +/-   ##
==========================================
+ Coverage   91.77%    91.8%   +0.03%     
==========================================
  Files         152      152              
  Lines       49205    49222      +17     
==========================================
+ Hits        45159    45190      +31     
+ Misses       4046     4032      -14
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.19% <100%> (+0.03%)` | :arrow_up: |
| #single | `41.84% <0%> (-0.02%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/20000?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/plotting/\_core.py](https://codecov.io/gh/pandas-dev/pandas/pull/20000/diff?src=pr&el=tree#diff-cGFuZGFzL3Bsb3R0aW5nL19jb3JlLnB5) | `82.5% <100%> (+0.23%)` | :arrow_up: |
| [pandas/core/window.py](https://codecov.io/gh/pandas-dev/pandas/pull/20000/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvd2luZG93LnB5) | `96.26% <0%> (-0.01%)` | :arrow_down: |
| [pandas/io/json/normalize.py](https://codecov.io/gh/pandas-dev/pandas/pull/20000/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2pzb24vbm9ybWFsaXplLnB5) | `96.93% <0%> (+0.06%)` | :arrow_up: |
| [pandas/util/testing.py](https://codecov.io/gh/pandas-dev/pandas/pull/20000/diff?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvdGVzdGluZy5weQ==) | `84.11% <0%> (+0.16%)` | :arrow_up: |
| [pandas/plotting/\_converter.py](https://codecov.io/gh/pandas-dev/pandas/pull/20000/diff?src=pr&el=tree#diff-cGFuZGFzL3Bsb3R0aW5nL19jb252ZXJ0ZXIucHk=) | `66.81% <0%> (+1.73%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/20000?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/20000?src=pr&el=footer). Last update [7273ea0...37a6eca](https://codecov.io/gh/pandas-dev/pandas/pull/20000?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

Yeah, raising is probably best.

On Tue, Mar 6, 2018 at 7:34 AM, Mason Gallo <notifications@github.com>
wrote:

> *@MasonGallo* commented on this pull request.
> ------------------------------
>
> In pandas/tests/plotting/test_frame.py
> <https://github.com/pandas-dev/pandas/pull/20000#discussion_r172555450>:
>
> >          df = DataFrame([[1, 3, 5], [2, 4, 6]], columns=list('AAB'))
>          with pytest.raises(ValueError):
>              df.plot(x=x, y=y)
>
> +    @pytest.mark.parametrize("y,lbl", [
> +        (['B'], ['b']),
> +        (['B', 'C'], ['b', 'c'])
> +    ])
> +    def test_y_listlike(self, y, lbl):
> +        # GH 19699
> +        df = DataFrame({"A": [1, 2], 'B': [3, 4], 'C': [5, 6]})
> +        _check_plot_works(df.plot, x='A', y=y, label=lbl)
> +
>
> Mix of int and named columns. x=0, y=['A', 2]
>
> Good point. Shouldn't this raise tho? If you try this on a DataFrame
> you'll get a KeyError. IMO we shouldn't allow users to specify a mix of
> int & named cols since it's unclear what you actually want.
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <https://github.com/pandas-dev/pandas/pull/20000#discussion_r172555450>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/ABQHIi3rkFHROQ43I43ijONt8_Oy7Xgkks5tbqyNgaJpZM4SdaP5>
> .
>

I addressed #20056 and added test cases to cover it. Also added a bunch more test cases to increase coverage as requested.
Any ideas on the failure on CircleCI? I'm on a mac so it looks like the test gets skipped locally?
> Any ideas on the failure on CircleCI? I'm on a mac so it looks like the test gets skipped locally?

Merge master into your branch and repush. The'll be fixed.
@TomAugspurger good suggestion! I think it's doable depending on where we land with the API discussion -
ping, tests green
Thanks @MasonGallo!