STYLE: Fixing #18419 - Fixing flake8 issues to allow for >3.4.1 support
State: closed

- [x] closes #18419
- [x] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry

There were tons of E722's, in a lot of cases I did not know what exceptions the author was expecting, so have unfortunately had to mark as `except Exception`, but where possible, have been more specific. If the reviewer/s know the expected exceptions then happy to adjust.

Tested on flake8 3.5, log below:
```bash
(pandas-dev) ajc:pandas aaron$ ci/lint.sh 
inside ci/lint.sh
Linting *.py
Linting *.py DONE
Linting setup.py
Linting setup.py DONE
Linting asv_bench/benchmarks/
Linting asv_bench/benchmarks/*.py DONE
Linting scripts/*.py
Linting scripts/*.py DONE
Linting doc scripts
Linting doc scripts DONE
Linting *.pyx
Linting *.pyx DONE
Linting *.pxi.in
linting -> pandas/src
Linting *.pxi.in DONE
Linting *.pxd
linting -> pandas/_libs
Linting *.pxd DONE
Linting *.c and *.h
linting -> pandas/_libs/src/*.h
ci/lint.sh: line 101: cpplint: command not found
linting -> pandas/_libs/src/parser
ci/lint.sh: line 101: cpplint: command not found
linting -> pandas/_libs/src/ujson
ci/lint.sh: line 101: cpplint: command not found
linting -> pandas/_libs/tslibs/src/datetime
ci/lint.sh: line 107: cpplint: command not found
Linting *.c and *.h DONE
Check for invalid testing
Check for invalid testing DONE
Check for non-standard imports
Check for non-standard imports DONE
Check for incorrect sphinx directives
Check for incorrect sphinx directives DONE
Check for deprecated messages without sphinx directive
Check for deprecated messages without sphinx directive DONE
Check for old-style classes
Check for old-style classes DONE
Check for backticks incorrectly rendering because of missing spaces
Check for backticks incorrectly rendering because of missing spaces DONE
(pandas-dev) ajc:pandas aaron$ flake8 --version
3.5.0 (flake8-comprehensions: 1.4.1, mccabe: 0.6.1, pycodestyle: 2.3.1, pyflakes: 1.6.0) CPython 3.6.5 on Darwin
```

Labels:

Comments:
Hello @AaronCritchley! Thanks for submitting the PR.

 - There are no PEP8 issues in the file [`doc/source/conf.py`](https://github.com/AaronCritchley/pandas/blob/c251daee88712e405ceccccab7a93727ec633394/doc/source/conf.py) !

 - There are no PEP8 issues in the file [`pandas/compat/pickle_compat.py`](https://github.com/AaronCritchley/pandas/blob/c251daee88712e405ceccccab7a93727ec633394/pandas/compat/pickle_compat.py) !

 - There are no PEP8 issues in the file [`pandas/core/computation/pytables.py`](https://github.com/AaronCritchley/pandas/blob/c251daee88712e405ceccccab7a93727ec633394/pandas/core/computation/pytables.py) !

 - There are no PEP8 issues in the file [`pandas/core/dtypes/common.py`](https://github.com/AaronCritchley/pandas/blob/c251daee88712e405ceccccab7a93727ec633394/pandas/core/dtypes/common.py) !

 - There are no PEP8 issues in the file [`pandas/core/dtypes/dtypes.py`](https://github.com/AaronCritchley/pandas/blob/c251daee88712e405ceccccab7a93727ec633394/pandas/core/dtypes/dtypes.py) !

 - There are no PEP8 issues in the file [`pandas/core/frame.py`](https://github.com/AaronCritchley/pandas/blob/c251daee88712e405ceccccab7a93727ec633394/pandas/core/frame.py) !

 - There are no PEP8 issues in the file [`pandas/core/indexes/frozen.py`](https://github.com/AaronCritchley/pandas/blob/c251daee88712e405ceccccab7a93727ec633394/pandas/core/indexes/frozen.py) !

 - There are no PEP8 issues in the file [`pandas/core/indexes/multi.py`](https://github.com/AaronCritchley/pandas/blob/c251daee88712e405ceccccab7a93727ec633394/pandas/core/indexes/multi.py) !

 - There are no PEP8 issues in the file [`pandas/core/indexing.py`](https://github.com/AaronCritchley/pandas/blob/c251daee88712e405ceccccab7a93727ec633394/pandas/core/indexing.py) !

 - There are no PEP8 issues in the file [`pandas/core/internals/blocks.py`](https://github.com/AaronCritchley/pandas/blob/c251daee88712e405ceccccab7a93727ec633394/pandas/core/internals/blocks.py) !

 - There are no PEP8 issues in the file [`pandas/core/nanops.py`](https://github.com/AaronCritchley/pandas/blob/c251daee88712e405ceccccab7a93727ec633394/pandas/core/nanops.py) !

 - There are no PEP8 issues in the file [`pandas/core/ops.py`](https://github.com/AaronCritchley/pandas/blob/c251daee88712e405ceccccab7a93727ec633394/pandas/core/ops.py) !

 - There are no PEP8 issues in the file [`pandas/core/sparse/array.py`](https://github.com/AaronCritchley/pandas/blob/c251daee88712e405ceccccab7a93727ec633394/pandas/core/sparse/array.py) !

 - There are no PEP8 issues in the file [`pandas/core/tools/datetimes.py`](https://github.com/AaronCritchley/pandas/blob/c251daee88712e405ceccccab7a93727ec633394/pandas/core/tools/datetimes.py) !

 - There are no PEP8 issues in the file [`pandas/core/window.py`](https://github.com/AaronCritchley/pandas/blob/c251daee88712e405ceccccab7a93727ec633394/pandas/core/window.py) !

 - There are no PEP8 issues in the file [`pandas/io/clipboards.py`](https://github.com/AaronCritchley/pandas/blob/c251daee88712e405ceccccab7a93727ec633394/pandas/io/clipboards.py) !

 - There are no PEP8 issues in the file [`pandas/io/formats/console.py`](https://github.com/AaronCritchley/pandas/blob/c251daee88712e405ceccccab7a93727ec633394/pandas/io/formats/console.py) !

 - There are no PEP8 issues in the file [`pandas/io/formats/terminal.py`](https://github.com/AaronCritchley/pandas/blob/c251daee88712e405ceccccab7a93727ec633394/pandas/io/formats/terminal.py) !

 - There are no PEP8 issues in the file [`pandas/io/packers.py`](https://github.com/AaronCritchley/pandas/blob/c251daee88712e405ceccccab7a93727ec633394/pandas/io/packers.py) !

 - There are no PEP8 issues in the file [`pandas/io/parsers.py`](https://github.com/AaronCritchley/pandas/blob/c251daee88712e405ceccccab7a93727ec633394/pandas/io/parsers.py) !

 - There are no PEP8 issues in the file [`pandas/io/pickle.py`](https://github.com/AaronCritchley/pandas/blob/c251daee88712e405ceccccab7a93727ec633394/pandas/io/pickle.py) !

 - There are no PEP8 issues in the file [`pandas/io/pytables.py`](https://github.com/AaronCritchley/pandas/blob/c251daee88712e405ceccccab7a93727ec633394/pandas/io/pytables.py) !

 - There are no PEP8 issues in the file [`pandas/io/sas/sas_xport.py`](https://github.com/AaronCritchley/pandas/blob/c251daee88712e405ceccccab7a93727ec633394/pandas/io/sas/sas_xport.py) !

 - There are no PEP8 issues in the file [`pandas/io/sas/sasreader.py`](https://github.com/AaronCritchley/pandas/blob/c251daee88712e405ceccccab7a93727ec633394/pandas/io/sas/sasreader.py) !

 - There are no PEP8 issues in the file [`pandas/io/sql.py`](https://github.com/AaronCritchley/pandas/blob/c251daee88712e405ceccccab7a93727ec633394/pandas/io/sql.py) !

 - There are no PEP8 issues in the file [`pandas/io/stata.py`](https://github.com/AaronCritchley/pandas/blob/c251daee88712e405ceccccab7a93727ec633394/pandas/io/stata.py) !

 - There are no PEP8 issues in the file [`pandas/tests/frame/test_arithmetic.py`](https://github.com/AaronCritchley/pandas/blob/c251daee88712e405ceccccab7a93727ec633394/pandas/tests/frame/test_arithmetic.py) !

 - There are no PEP8 issues in the file [`pandas/tests/indexing/common.py`](https://github.com/AaronCritchley/pandas/blob/c251daee88712e405ceccccab7a93727ec633394/pandas/tests/indexing/common.py) !

 - There are no PEP8 issues in the file [`pandas/tests/io/formats/test_format.py`](https://github.com/AaronCritchley/pandas/blob/c251daee88712e405ceccccab7a93727ec633394/pandas/tests/io/formats/test_format.py) !

 - There are no PEP8 issues in the file [`pandas/tests/io/test_pytables.py`](https://github.com/AaronCritchley/pandas/blob/c251daee88712e405ceccccab7a93727ec633394/pandas/tests/io/test_pytables.py) !

 - There are no PEP8 issues in the file [`pandas/tests/io/test_sql.py`](https://github.com/AaronCritchley/pandas/blob/c251daee88712e405ceccccab7a93727ec633394/pandas/tests/io/test_sql.py) !

 - There are no PEP8 issues in the file [`pandas/tests/test_multilevel.py`](https://github.com/AaronCritchley/pandas/blob/c251daee88712e405ceccccab7a93727ec633394/pandas/tests/test_multilevel.py) !

 - There are no PEP8 issues in the file [`pandas/tests/test_nanops.py`](https://github.com/AaronCritchley/pandas/blob/c251daee88712e405ceccccab7a93727ec633394/pandas/tests/test_nanops.py) !

 - There are no PEP8 issues in the file [`pandas/tests/test_panel.py`](https://github.com/AaronCritchley/pandas/blob/c251daee88712e405ceccccab7a93727ec633394/pandas/tests/test_panel.py) !

 - There are no PEP8 issues in the file [`pandas/tests/test_strings.py`](https://github.com/AaronCritchley/pandas/blob/c251daee88712e405ceccccab7a93727ec633394/pandas/tests/test_strings.py) !

 - There are no PEP8 issues in the file [`pandas/tseries/holiday.py`](https://github.com/AaronCritchley/pandas/blob/c251daee88712e405ceccccab7a93727ec633394/pandas/tseries/holiday.py) !

 - There are no PEP8 issues in the file [`pandas/util/_print_versions.py`](https://github.com/AaronCritchley/pandas/blob/c251daee88712e405ceccccab7a93727ec633394/pandas/util/_print_versions.py) !

 - There are no PEP8 issues in the file [`pandas/util/_validators.py`](https://github.com/AaronCritchley/pandas/blob/c251daee88712e405ceccccab7a93727ec633394/pandas/util/_validators.py) !




we don’t want to simply mark Exception otherwise these will be overly broad

it is tedious but the way to do this is to comment the try/except and add back until the tests pass

most of these should be Type orr Value Errors or both

prob best to break this PR up a bit 

after everything is done then can be more strict in the linter 
Sure, no worries, will close and try to find time to do this in smaller chunks with proper exception catches