STYLE: run pre-commit filters on the repo
State: closed

I noticed that `pre-commit` is used and ran `pre-commit run --all-files` which results in massive diffs, mostly because of `isort`.

I have added the correct `noqa` and `isort:skip` flags to the lines which needed it to function correctly with the current `.pre-commit-config.yaml`, such that the imports are correctly sorted now.

I also added `seed-isort-config` such that `setup.cfg` is parsed for `pre-commit` and fixed the formatting of `.pre-commit-config.yaml`.

~~Finally, there is `pandas/__init__.py` that is touched by `pre-commit run --all-files`, however, this has less trivial changes and might result in something breaking, so I don't dare to touch it.~~
It was because the `skip` entry in `[isort]` in `setup.cfg` is somehow ignored when running pre-commit and I can't figure out why (I will open an issue in the `isort` repo when it's clear that this will be merged). I have also deleted the other ignored files because I fixed the problems there. `pandas/core/api.py` needs to stay in `skip` because `isort` and `black` make conflicting edits.

Labels:

Comments:
Hello @basnijholt! 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:





































































































There are currently no PEP 8 issues detected in this Pull Request. Cheers! :beers: 

##### Comment last updated at 2019-08-19 13:43:32 UTC
> seed-isort-config

Can you say a bit more about why this is needed / what it does? I'm not familiar with it.
are you sure that you have merged the latest master. these should not be necessary.
@jreback, yes I have just rebased on the latest master.
@TomAugspurger, `seed-isort-config` statically populates the [`known_third_party`](https://github.com/pandas-dev/pandas/pull/27915/files#diff-380c6a8ebbbce17d55d50ef17d3cf906R119) field, such that `isort` works correctly. Previously `hypothesis` wasn't correctly sorted, even though it was already listed. `seed-isort-config` ensures that all third party libs are there, now `isort` works as expected.
Thanks for the explanation.

Have you checked why the CI is failing? Seems there's an import issue.

On Thu, Aug 15, 2019 at 8:41 AM Bas Nijholt <notifications@github.com>
wrote:

> @TomAugspurger <https://github.com/TomAugspurger>, seed-isort-config
> statically populates the known_third_party
> <https://github.com/pandas-dev/pandas/pull/27915/files#diff-380c6a8ebbbce17d55d50ef17d3cf906R119>
> field, such that isort works correctly. Previously hypothesis wasn't
> correctly sorted, even though it was already listed. seed-isort-config
> ensures that all third party libs are there, now isort works as expected.
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <https://github.com/pandas-dev/pandas/pull/27915?email_source=notifications&email_token=AAKAOIUQSR2HKLYQJXU4GJLQEVMIFA5CNFSM4ILS7FI2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4L2WQY#issuecomment-521644867>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AAKAOITK6N6VTWFR46A7Y53QEVMIFANCNFSM4ILS7FIQ>
> .
>

@TomAugspurger there seems to be some kind of circular import. I will fix it! 👍 
I think I fixed it.

For some reason `DataFrame` needs to be imported after `NamedAgg` to avoid a circular import.

This is probably a bug too, I've added a comment for now.

Also, I've done an interactive rebase on top of master and made the commits into logical separate changes.
Thanks. Looks like a black issue on our CI: https://dev.azure.com/pandas-dev/pandas/_build/results?buildId=16280.
All passes now 👍 
Thanks @sbalk!