STYLE use ast.parse instead of regex to fixup inconsistencies in namespace
- [x] tests added / passed
- [x] Ensure all linting tests pass, see [here](https://pandas.pydata.org/pandas-docs/dev/development/contributing.html#code-standards) for how to run them

The regular expression wasn't working too well, this solution should be better. Also, like this, you can pass `--replace` and have the inconsistencies fixed up for you (though I haven't passed this by default as it may be confusing)

Just running on `pandas/tests/frame/` here, can expand to the rest in separate PRs if this is alright
@momisbestfriend can you take a look?  IIRC you did a lot of the ast-based checks > @momisbestfriend can you take a look? IIRC you did a lot of the ast-based checks

@ShaharNaveh  > lgtm ex @jorisvandenbossche comments

Thanks - I believe these were addressed in d7825aa, but Joris do let me know if you had something different in mind i think i got into the habit of importing array as pd_array bc there are a number of places where we use "array" as a variable name (or in principle could be using the stdlib array module) and name overlap of that form bothers me more than most > @momisbestfriend can you take a look? IIRC you did a lot of the ast-based checks

Yes correct I did a lot of AST checks:)

This script looks amazing, LGTM:) > This script looks amazing

Thanks - I learned loads by studying the [pyupgrade](https://github.com/asottile/pyupgrade) source code @MarcoGorelli can you merge master and ping on green. i think this is fine (and followup PRs to add coverage are good). Sure, have merged - @jreback 

EDIT I'll try re-writing this slightly so it's just standard library, then the same local virtualenv as is used for lots of other checks can be reused


UPDATE
------

Now, `tokenize-rt` is only required if using the `--replace` flag. This way, the pre-commit hook can re-use the same virtualenv as other local Python hooks Hello @MarcoGorelli! 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 2021-02-18 12:12:43 UTC thanks @MarcoGorelli pls open an issue to fix the non-checked parts of the codebase. > thanks @MarcoGorelli pls open an issue to fix the non-checked parts of the codebase.

Thanks - I'm running a little event with PyLadies London on the 6th of March, so I'll get participants to work on this then