BUG: incorrect output of first('1M') in case if first index is the last day of the month (#29623)
- [ ] closes #29623 
- [ ] tests added / passed
- [ ] passes `black pandas`
- [ ] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry

Hello @Franklinluo17! Thanks for updating this PR. We checked the lines you've touched for [PEP 8](https://www.python.org/dev/peps/pep-0008) issues, and found:

* In the file [`pandas/core/generic.py`](https://github.com/pandas-dev/pandas/blob/4fa289dc3394acf5460f57a9094e2e396b3a8c0f/pandas/core/generic.py):

> [Line 8553:1](https://github.com/pandas-dev/pandas/blob/4fa289dc3394acf5460f57a9094e2e396b3a8c0f/pandas/core/generic.py#L8553): [W293](https://duckduckgo.com/?q=pep8%20W293) blank line contains whitespace

* In the file [`pandas/tests/generic/test_generic.py`](https://github.com/pandas-dev/pandas/blob/4fa289dc3394acf5460f57a9094e2e396b3a8c0f/pandas/tests/generic/test_generic.py):

> [Line 915:9](https://github.com/pandas-dev/pandas/blob/4fa289dc3394acf5460f57a9094e2e396b3a8c0f/pandas/tests/generic/test_generic.py#L915): [E704](https://duckduckgo.com/?q=pep8%20E704) multiple statements on one line (def)
> [Line 925:9](https://github.com/pandas-dev/pandas/blob/4fa289dc3394acf5460f57a9094e2e396b3a8c0f/pandas/tests/generic/test_generic.py#L925): [E704](https://duckduckgo.com/?q=pep8%20E704) multiple statements on one line (def)
> [Line 934:9](https://github.com/pandas-dev/pandas/blob/4fa289dc3394acf5460f57a9094e2e396b3a8c0f/pandas/tests/generic/test_generic.py#L934): [E704](https://duckduckgo.com/?q=pep8%20E704) multiple statements on one line (def)



##### Comment last updated at 2019-12-08 03:45:40 UTC closing as stale, if you want to continue, pls ping.