Skip to content Skip to sidebar Skip to footer

Python Pandas: Increase Maximum Number Of Rows

I am processing a large text file (500k lines), formatted as below: S1_A16 0.141,0.009340221649748676 0.141,4.192618196894668E-5 0.11,0.014122135626540204 S1_A17 0.188,2.3292323316

Solution 1:

The error message:

TypeError: unsupported operand type(s) for -: 'NoneType' and 'int'

is saying None minus an int is a TypeError. If you look at the next-to-last line in the traceback you see that the only subtraction going on there is

max_rows - 4

So max_rows must be None. If you dive into /Users/adamg/anaconda/lib/python2.7/site-packages/pandas/core/series.py, near line 857 and ask yourself how max_rows could end up being equal to None, you'll see that somehow

get_option("display.max_rows")

must be returning None.

This part of the code is calling _tidy_repr which is used to summarize the Series. None is the correct value to set when you want pandas to display all lines of the Series. So this part of the code should not have been reached when max_rows is None.

I've made a pull request to correct this.

Post a Comment for "Python Pandas: Increase Maximum Number Of Rows"