BUG: DataFrame.first_valid_index() fails if there is no valid entry.
State: closed

Just checking the number of valid entries and if it's zero, return `None`.

Also fixed same issue on `DataFrame.last_valid_index()`.
Add docstrings to both methods of `DataFrame` and `Series`.

- [x] closes #17400
- [x] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry


Labels:
name: Bug
name: Indexing
description: Related to indexing on series/frames, not to indexes themselves
name: Error Reporting
description: Incorrect or improved errors from pandas

Comments:
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17488?src=pr&el=h1) Report
> Merging [#17488](https://codecov.io/gh/pandas-dev/pandas/pull/17488?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/fdbc6b8f4b36f07da62fc901b19754f922ae3952?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/17488/graphs/tree.svg?height=150&width=650&src=pr&token=eZ4WkYLtcO)](https://codecov.io/gh/pandas-dev/pandas/pull/17488?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #17488      +/-   ##
==========================================
- Coverage   91.15%   91.13%   -0.02%     
==========================================
  Files         163      163              
  Lines       49534    49539       +5     
==========================================
- Hits        45153    45149       -4     
- Misses       4381     4390       +9
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `88.92% <100%> (ø)` | :arrow_up: |
| #single | `40.22% <14.28%> (-0.07%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/17488?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/series.py](https://codecov.io/gh/pandas-dev/pandas/pull/17488?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvc2VyaWVzLnB5) | `94.95% <ø> (ø)` | :arrow_up: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/17488?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.72% <100%> (-0.1%)` | :arrow_down: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/17488?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17488?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/17488?src=pr&el=footer). Last update [fdbc6b8...144de64](https://codecov.io/gh/pandas-dev/pandas/pull/17488?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/17488?src=pr&el=h1) Report
> Merging [#17488](https://codecov.io/gh/pandas-dev/pandas/pull/17488?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/46856c3936540a47df719d10a7699eb35673e4a4?src=pr&el=desc) will **increase** coverage by `<.01%`.
> The diff coverage is `100%`.

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

```diff
@@            Coverage Diff             @@
##           master   #17488      +/-   ##
==========================================
+ Coverage   91.15%   91.16%   +<.01%     
==========================================
  Files         163      163              
  Lines       49534    49540       +6     
==========================================
+ Hits        45153    45162       +9     
+ Misses       4381     4378       -3
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `88.94% <100%> (+0.02%)` | :arrow_up: |
| #single | `40.22% <50%> (-0.07%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/17488?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/generic.py](https://codecov.io/gh/pandas-dev/pandas/pull/17488?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZ2VuZXJpYy5weQ==) | `91.99% <100%> (ø)` | :arrow_up: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/17488?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.72% <100%> (-0.1%)` | :arrow_down: |
| [pandas/core/series.py](https://codecov.io/gh/pandas-dev/pandas/pull/17488?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvc2VyaWVzLnB5) | `94.95% <100%> (ø)` | :arrow_up: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/17488?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/plotting/\_converter.py](https://codecov.io/gh/pandas-dev/pandas/pull/17488?src=pr&el=tree#diff-cGFuZGFzL3Bsb3R0aW5nL19jb252ZXJ0ZXIucHk=) | `65.05% <0%> (+1.81%)` | :arrow_up: |

------

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

Hello @skwbc! Thanks for updating the PR.









Cheers ! There are no PEP8 issues in this Pull Request. :beers: 

##### Comment last updated on September 11, 2017 at 14:08 Hours UTC
thanks!