Melting with not present column does not produce error
- [x] closes #23570
- [x] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry

Hello @michaelsilverstein! Thanks for updating the PR.

 - There are no PEP8 issues in the file [`pandas/core/reshape/melt.py`](https://github.com/michaelsilverstein/pandas/blob/39c746be9c7ba618a609aa3aa12b347b952fa70b/pandas/core/reshape/melt.py) !

 - There are no PEP8 issues in the file [`pandas/tests/reshape/test_melt.py`](https://github.com/michaelsilverstein/pandas/blob/39c746be9c7ba618a609aa3aa12b347b952fa70b/pandas/tests/reshape/test_melt.py) !



##### Comment last updated on November 15, 2018 at 22:12 Hours UTC # [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/23575?src=pr&el=h1) Report
> Merging [#23575](https://codecov.io/gh/pandas-dev/pandas/pull/23575?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/a23f90142352b6427916292b2b9faa7bb61d07bc?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/23575/graphs/tree.svg?width=650&token=eZ4WkYLtcO&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/23575?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #23575      +/-   ##
==========================================
+ Coverage   92.25%   92.29%   +0.03%     
==========================================
  Files         161      161              
  Lines       51383    51500     +117     
==========================================
+ Hits        47404    47531     +127     
+ Misses       3979     3969      -10
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.68% <100%> (+0.04%)` | :arrow_up: |
| #single | `42.31% <10%> (-0.01%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/23575?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/reshape/melt.py](https://codecov.io/gh/pandas-dev/pandas/pull/23575/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvcmVzaGFwZS9tZWx0LnB5) | `97.54% <100%> (+0.21%)` | :arrow_up: |
| [pandas/core/arrays/datetimelike.py](https://codecov.io/gh/pandas-dev/pandas/pull/23575/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL2RhdGV0aW1lbGlrZS5weQ==) | `95.96% <0%> (-0.19%)` | :arrow_down: |
| [pandas/io/formats/format.py](https://codecov.io/gh/pandas-dev/pandas/pull/23575/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2Zvcm1hdHMvZm9ybWF0LnB5) | `97.76% <0%> (-0.12%)` | :arrow_down: |
| [pandas/core/indexes/timedeltas.py](https://codecov.io/gh/pandas-dev/pandas/pull/23575/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy90aW1lZGVsdGFzLnB5) | `89.18% <0%> (-0.08%)` | :arrow_down: |
| [pandas/core/arrays/integer.py](https://codecov.io/gh/pandas-dev/pandas/pull/23575/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL2ludGVnZXIucHk=) | `95.47% <0%> (-0.02%)` | :arrow_down: |
| [pandas/tseries/frequencies.py](https://codecov.io/gh/pandas-dev/pandas/pull/23575/diff?src=pr&el=tree#diff-cGFuZGFzL3RzZXJpZXMvZnJlcXVlbmNpZXMucHk=) | `97.06% <0%> (-0.02%)` | :arrow_down: |
| [pandas/tseries/offsets.py](https://codecov.io/gh/pandas-dev/pandas/pull/23575/diff?src=pr&el=tree#diff-cGFuZGFzL3RzZXJpZXMvb2Zmc2V0cy5weQ==) | `96.98% <0%> (-0.01%)` | :arrow_down: |
| [pandas/core/arrays/period.py](https://codecov.io/gh/pandas-dev/pandas/pull/23575/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL3BlcmlvZC5weQ==) | `98.44% <0%> (-0.01%)` | :arrow_down: |
| [pandas/core/util/hashing.py](https://codecov.io/gh/pandas-dev/pandas/pull/23575/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvdXRpbC9oYXNoaW5nLnB5) | `98.4% <0%> (ø)` | :arrow_up: |
| [pandas/plotting/\_core.py](https://codecov.io/gh/pandas-dev/pandas/pull/23575/diff?src=pr&el=tree#diff-cGFuZGFzL3Bsb3R0aW5nL19jb3JlLnB5) | `83.63% <0%> (ø)` | :arrow_up: |
| ... and [38 more](https://codecov.io/gh/pandas-dev/pandas/pull/23575/diff?src=pr&el=tree-more) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/23575?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/23575?src=pr&el=footer). Last update [a23f901...0db8838](https://codecov.io/gh/pandas-dev/pandas/pull/23575?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
 @jreback would you be able to point me to some documentation on how to properly document tests and a whatsnew entry? All the contributing docs are at http://pandas-docs.github.io/pandas-docs-travis/contributing.html

release notes: http://pandas-docs.github.io/pandas-docs-travis/contributing.html#documenting-your-code You may need to escape the `[` and `]` in the match.

On Tue, Nov 13, 2018 at 4:30 PM Michael Silverstein <
notifications@github.com> wrote:

> *@michaelsilverstein* commented on this pull request.
> ------------------------------
>
> In pandas/tests/reshape/test_melt.py
> <https://github.com/pandas-dev/pandas/pull/23575#discussion_r233248166>:
>
> > @@ -661,3 +661,36 @@ def test_col_substring_of_stubname(self):
>                                   i=['node_id', 'A'],
>                                   j='time')
>          tm.assert_frame_equal(result, expected)
> +
> +    def test_melt_missing_columns(self):
> +        # GH-23575
> +        # This test is to ensure that pandas raises an error if melting is
> +        # attempted with column names absent from the dataframe
> +
> +        # Generate data
> +        df = pd.DataFrame(np.random.randn(5, 4), columns=list('abcd'))
> +
> +        # Try to melt with missing `value_vars` column name
> +        with pytest.raises(KeyError, match="The following 'value_vars' are not"
>
> Regex wasn't working and now when I try pytest with match equal to the
> exact output of the error message (as before) I get this frustrating error:
>
> AssertionError: Pattern 'The following 'value_vars' are not present in the
> DataFrame: ['C']' not found in '"The following 'value_vars' are not present
> in the DataFrame: ['C']"'
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <https://github.com/pandas-dev/pandas/pull/23575#discussion_r233248166>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/ABQHIn5i7rcFplFXCToXnbwsh-Nf_wxuks5uu0fygaJpZM4YVNGG>
> .
>
 The failures with Travis-CI are independent of my changes. A lot of them are related to `pyarrow` @jreback CircleCI and Azure have passed. Failure in TravisCI seems unrelated (@TomAugspurger agrees it seems).  This failure is real: https://travis-ci.org/pandas-dev/pandas/jobs/455623394#L2875

It seems there's an issue with MultiIndex in the columns. I'm surprised there aren't tests for that outside of the docstring. I'll add the tests from the docstring explicitly  I think this is the only error from TravisCI now?
https://travis-ci.org/pandas-dev/pandas/jobs/455723256#L2807 yeah this looks like a ci/code_checks.sh error, run it locally and see Specifically https://travis-ci.org/pandas-dev/pandas/jobs/455723256#L2745 and https://travis-ci.org/pandas-dev/pandas/jobs/455723256#L2727 What is the proper order of imports? I had to import `Index` http://pandas-docs.github.io/pandas-docs-travis/contributing.html#import-formatting

SO something like `isort pandas/core/reshape/melt.py` I think the failure from TravisCI passed here:
https://travis-ci.org/michaelsilverstein/pandas/builds/456028319 lgtm. ping on green. thanks!