Skip to content

Pandas should validate display.max_rows option #23348

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
cosinequanon opened this issue Oct 26, 2018 · 1 comment · Fixed by #27382
Closed

Pandas should validate display.max_rows option #23348

cosinequanon opened this issue Oct 26, 2018 · 1 comment · Fixed by #27382
Labels
Error Reporting Incorrect or improved errors from pandas Output-Formatting __repr__ of pandas objects, to_string
Milestone

Comments

@cosinequanon
Copy link

Code Sample, a copy-pastable example if possible

import pandas as pd
pd.set_option('display.max_rows', -1)
test = [['a', 'b'] ,['c','d'] ,['f','g']]
pd.DataFrame(test, columns=['columna', 'columnb'])

Problem description

This incorrectly print's 4 rows:

Out[1]:
..     ...     ...
   columna columnb
0        a       b
1        c       d
1        c       d
2        f       g

[3 rows x 2 columns]

Pandas should not allow negative numbers for this setting because it does non-sensical things. In many other places -1 is used to represent an unbounded number so setting it -1 is actually intuitive but it doesn't work correctly and we should fail fast instead of confusing users.

Expected Output

Out[1]:
..     ...     ...
   columna columnb
0        a       b
1        c       d
2        f       g

[3 rows x 2 columns]

Output of pd.show_versions()

[paste the output of pd.show_versions() here below this line]
INSTALLED VERSIONS

commit: None
python: 3.6.3.candidate.1
python-bits: 64
OS: Linux
OS-release: 4.11.3-67_fbk17_4093_g2bf19e7a0b95
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL:
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8

pandas: 0.23.4
pytest: None
pip: None
setuptools: 40.4.3
Cython: 0.29a0
numpy: 1.15.1
scipy: 1.1.0
pyarrow: None
xarray: None
IPython: 6.5.0
sphinx: None
patsy: 0.4.1
dateutil: 2.7.3
pytz: 2018.4
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: 2.2.3
openpyxl: 2.4.11
xlrd: 0.9.4
xlwt: None
xlsxwriter: None
lxml: 3.5.0
bs4: None
html5lib: 0.9999999
sqlalchemy: 1.1.13
pymysql: None
psycopg2: None
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None

@gfyoung gfyoung added Error Reporting Incorrect or improved errors from pandas Output-Formatting __repr__ of pandas objects, to_string labels Oct 26, 2018
@gfyoung
Copy link
Member

gfyoung commented Oct 26, 2018

That's a good idea. We should check all such configuration options and see whether we can perform validation similar to what you are describing for display.max_rows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Error Reporting Incorrect or improved errors from pandas Output-Formatting __repr__ of pandas objects, to_string
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants