BUG: #7757 Fix CSV parsing of singleton list header
State: closed

 - [ ] closes #7757
 - [ ] added ```test_singleton_header``` in ```pandas/tests/io/parser/header.py``` / passed
 - [ ] passes ``git diff upstream/master -u -- "*.py" | flake8 --diff``
 - [ ] what's new entry

I fixed an issue with CSV parsing where passing a single-row header as a list to ```pd.read_csv```
would result in a ```pd.DataFrame``` of all ```NaN``` values. I added a simple parser test of whether there are any ```NaN``` values in the ```pd.DataFrame``` returned by ```pd.read_csv``` given a header list of length one.

Labels:
name: Bug
name: IO CSV
description: read_csv, to_csv

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

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

```diff
@@            Coverage Diff             @@
##           master   #17090      +/-   ##
==========================================
- Coverage   91.02%   91.01%   -0.02%     
==========================================
  Files         161      161              
  Lines       49397    49399       +2     
==========================================
- Hits        44966    44961       -5     
- Misses       4431     4438       +7
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `88.78% <100%> (ø)` | :arrow_up: |
| #single | `40.28% <0%> (-0.07%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/17090?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/parsers.py](https://codecov.io/gh/pandas-dev/pandas/pull/17090?src=pr&el=tree#diff-cGFuZGFzL2lvL3BhcnNlcnMucHk=) | `95.45% <100%> (ø)` | :arrow_up: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/17090?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/17090?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.71% <0%> (-0.05%)` | :arrow_down: |
| [pandas/core/generic.py](https://codecov.io/gh/pandas-dev/pandas/pull/17090?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZ2VuZXJpYy5weQ==) | `92.07% <0%> (+0.05%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17090?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/17090?src=pr&el=footer). Last update [e3b7840...2e9a504](https://codecov.io/gh/pandas-dev/pandas/pull/17090?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17090?src=pr&el=h1) Report
> Merging [#17090](https://codecov.io/gh/pandas-dev/pandas/pull/17090?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/55ae03986dab53f39c1df2b8a5e3532f89ad22be?src=pr&el=desc) will **decrease** coverage by `0.04%`.
> The diff coverage is `100%`.

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

```diff
@@            Coverage Diff             @@
##           master   #17090      +/-   ##
==========================================
- Coverage   91.01%   90.97%   -0.05%     
==========================================
  Files         162      162              
  Lines       49498    49499       +1     
==========================================
- Hits        45053    45034      -19     
- Misses       4445     4465      +20
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `88.75% <100%> (-0.03%)` | :arrow_down: |
| #single | `40.26% <0%> (-0.07%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/17090?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/parsers.py](https://codecov.io/gh/pandas-dev/pandas/pull/17090?src=pr&el=tree#diff-cGFuZGFzL2lvL3BhcnNlcnMucHk=) | `95.45% <100%> (ø)` | :arrow_up: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/17090?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/plotting/\_converter.py](https://codecov.io/gh/pandas-dev/pandas/pull/17090?src=pr&el=tree#diff-cGFuZGFzL3Bsb3R0aW5nL19jb252ZXJ0ZXIucHk=) | `63.23% <0%> (-1.82%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/17090?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.66% <0%> (-0.1%)` | :arrow_down: |
| [pandas/core/indexes/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/17090?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9kYXRldGltZXMucHk=) | `95.33% <0%> (+0.09%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17090?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/17090?src=pr&el=footer). Last update [55ae039...01c07bc](https://codecov.io/gh/pandas-dev/pandas/pull/17090?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

Thanks @threecgreen !