Autopep8
State: closed

Used [autopep8](https://github.com/hhatto/autopep8) to make all of pandas py files more PEP8 compliant (Excluding 230 `E501 lines too long` (over 80 chars), and 6 changes which had to be reverted to fix test failures - in second commit). See statistics in my comment.

I iterated over every py file in the package using [autopep8](https://github.com/hhatto/autopep8), inspected the output of [pep8](https://github.com/jcrocholl/pep8) to drill-down and consider any compliance issues found which may change the meaning of the code (and considered those individually).

I haven't included a unittest for PEP compliance using pep8.

For me this passes all the same tests as the master branch.

_Since this affects such a large set of the code it may not be reasonable to pull, however it is certainly a proof of concept._


Labels:

Comments:
To give some idea of the improvements from this, you could run (in pandas/pandas; apologies for poor shell-foo):

```
pep8 --statistics --filename *.py, */*.py
```

Comparing the two branches:

```
autopep8 branch:
4       E203 whitespace before ':'
3       E251 no spaces around keyword / parameter equals
4       E302 expected 2 blank lines, found 1
230     E501 line too long (93 > 79 characters)
6       E712 comparison to False should be 'if cond is False:' or 'if not cond:'
```

_Note: the 4,3,4 results are all from `src/generate_code.py`, and see second commit re the 6._

```
master branch:
1       E101 indentation contains mixed spaces and tabs
4       E111 indentation is not a multiple of four
20      E121 continuation line indentation is not a multiple of four
4       E123 closing bracket does not match indentation of opening bracket's line
55      E125 continuation line does not distinguish itself from next logical line
10      E126 continuation line over-indented for hanging indent
106     E127 continuation line over-indented for visual indent
102     E128 continuation line under-indented for visual indent
142     E201 whitespace after '['
116     E202 whitespace before ')'
680     E203 whitespace before ','
2       E211 whitespace before '('
216     E221 multiple spaces before operator
4       E222 multiple spaces after operator
122     E225 missing whitespace around operator
71      E226 missing optional whitespace around operator
1526    E231 missing whitespace after ','
116     E241 multiple spaces after ','
476     E251 no spaces around keyword / parameter equals
61      E261 at least two spaces before inline comment
8       E262 inline comment should start with '# '
3       E271 multiple spaces after keyword
3       E272 multiple spaces before keyword
39      E301 expected 1 blank line, found 0
244     E302 expected 2 blank lines, found 1
69      E303 too many blank lines (3)
1       E401 multiple imports on one line
358     E501 line too long (93 > 79 characters)
3       E502 the backslash is redundant between brackets
32      E701 multiple statements on one line (colon)
3       E702 multiple statements on one line (semicolon)
6       E711 comparison to None should be 'if cond is None:'
14      E712 comparison to True should be 'if cond is True:' or 'if cond:'
1       W191 indentation contains tabs
24      W291 trailing whitespace
7       W293 blank line contains whitespace
7       W391 blank line at end of file
2       W601 .has_key() is deprecated, use 'in'
4       W602 deprecated form of raising exception
```

_Of course, the health warning being that pep8 may not catch all PEP8 compliance issues._

Thanks for doing this. I guess I should just merge this before there are too many conflicts. The main pep8 thing I have trouble with is 2 blank lines between top level function/class defs. harumph