-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: Fix Index.__repr__ when display.max_seq_items
= 1
#38443
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
Changes from 8 commits
b0b363d
bbb19bd
cb829fb
62506cb
d5224da
539a055
ceefa45
3191e6f
280518a
4e381bf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -382,7 +382,11 @@ def best_len(values: List[str]) -> int: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
summary = f"[{first}, {last}]{close}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
else: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if n > max_seq_items: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if max_seq_items == 1: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you also cover in a test the max_seq_items == 0 case (I think we have this but maybe not). Also pls confirm that we have a test for n == max_seq_items. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like we don't have a test for Just wanted to confirm that this is the relevant location for adding these? pandas/pandas/tests/indexes/multi/test_formats.py Lines 92 to 119 in e2dec8d
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah there plus some generic Index ones (look in pandas/tests/indexes/); you may have to grep around a bit e.g.
i think There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we have a case of max_seq_items==0 ? (I think this is a valid value), < 0 is restricted i am pretty sure? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes we do. Max_seq_items ==0 implies unlimited if I'm not mistaken |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# If max_seq_items=1 show only last element | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
head = [] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
tail = [formatter(x) for x in obj[-1:]] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
elif n > max_seq_items: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
n = min(max_seq_items // 2, 10) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
head = [formatter(x) for x in obj[:n]] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
tail = [formatter(x) for x in obj[-n:]] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you undo this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Have reverted the changes.