Skip to content

BUG: display.max_seq_items set to 0 is treated as None #48092

Closed
@MarcoGorelli

Description

@MarcoGorelli

Pandas version checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

import pandas as pd

df = pd.DataFrame({'a': [1,2,3]})

with pd.option_context('display.max_rows', 1):
    print(df)
with pd.option_context('display.max_rows', 0):
    print(df)

Issue Description

1 only prints one row, but 0 prints all of them:

    a
0   1
.. ..

[3 rows x 1 columns]
   a
0  1
1  2
2  3

Expected Behavior

    a
0   1
.. ..

[3 rows x 1 columns]
    a
.. ..

[3 rows x 1 columns]

Installed Versions

/home/marco/miniconda3/envs/pandas-dev/lib/python3.8/site-packages/_distutils_hack/init.py:33: UserWarning: Setuptools is replacing distutils.
warnings.warn("Setuptools is replacing distutils.")

INSTALLED VERSIONS

commit : 06dd5da
python : 3.8.13.final.0
python-bits : 64
OS : Linux
OS-release : 5.4.0-121-generic
Version : #137-Ubuntu SMP Wed Jun 15 13:33:07 UTC 2022
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_GB.UTF-8
LOCALE : en_GB.UTF-8

pandas : 1.5.0.dev0+1295.g06dd5dab93
numpy : 1.22.4
pytz : 2022.2
dateutil : 2.8.2
setuptools : 63.2.0
pip : 22.2.2
Cython : 0.29.32
pytest : 7.1.2
hypothesis : 6.47.1
sphinx : 4.5.0
blosc : None
feather : None
xlsxwriter : 3.0.3
lxml.etree : 4.9.1
html5lib : 1.1
pymysql : 1.0.2
psycopg2 : 2.9.3
jinja2 : 3.0.3
IPython : 8.4.0
pandas_datareader: 0.10.0
bs4 : 4.11.1
bottleneck : 1.3.5
brotli :
fastparquet : 0.8.1
fsspec : 2021.07.0
gcsfs : 2021.07.0
matplotlib : 3.3.2
numba : 0.55.2
numexpr : 2.8.0
odfpy : None
openpyxl : 3.0.9
pandas_gbq : 0.15.0
pyarrow : 2.0.0
pyreadstat : 1.1.9
pyxlsb : 1.0.9
s3fs : 2021.07.0
scipy : 1.9.0
snappy :
sqlalchemy : 1.4.40
tables : 3.7.0
tabulate : 0.8.10
xarray : 2022.6.0
xlrd : 2.0.1
xlwt : 1.3.0
zstandard : 0.18.0
tzdata : None
None

Metadata

Metadata

Assignees

No one assigned

    Labels

    Output-Formatting__repr__ of pandas objects, to_string

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions