Skip to content

Setting option 'display.max_seq_items' to None results in TypeError when pprinting index #10182

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
JWarmenhoven opened this issue May 21, 2015 · 5 comments · Fixed by #10183
Closed
Labels
Bug Output-Formatting __repr__ of pandas objects, to_string Regression Functionality that used to work in a prior pandas version
Milestone

Comments

@JWarmenhoven
Copy link

According to the docstring, the following is allowed:

pd.set_option('display.max_seq_items', None)

With 0.16.1 this results in a TypeError when pretty printing an index. This is because the None value is compared against lenght of the index to see if we need to limit output.

TypeError: unorderable types: int() > NoneType()
@jorisvandenbossche jorisvandenbossche added Bug Output-Formatting __repr__ of pandas objects, to_string labels May 21, 2015
@jorisvandenbossche jorisvandenbossche added this to the 0.17.0 milestone May 21, 2015
@jorisvandenbossche
Copy link
Member

Thanks for the report!

@jorisvandenbossche jorisvandenbossche added the Regression Functionality that used to work in a prior pandas version label May 21, 2015
@jorisvandenbossche
Copy link
Member

@JWarmenhoven https://github.com/pydata/pandas/pull/10183/files should fix it. Can you try this out? (you can just change that one line in the source code)

@JWarmenhoven
Copy link
Author

You'll also need to change line 538 & 2559 into something like this for it to work.

max_seq_items = get_option('display.max_seq_items') or len(self) 

@jorisvandenbossche
Copy link
Member

Ah, yes, python 3. Thanks. Doing that means that the 'length' will never be shown, but maybe that is most consistent (only show that when truncated)?

@JWarmenhoven
Copy link
Author

I see.
Why not always output the 'length' attribute, regardless whether the output has been truncated or not?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Output-Formatting __repr__ of pandas objects, to_string Regression Functionality that used to work in a prior pandas version
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants