Skip to content

BUG: fix inconsistent col spacing in info #36766

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

Merged
merged 3 commits into from
Oct 7, 2020

Conversation

ivanovmg
Copy link
Member

@ivanovmg ivanovmg commented Oct 1, 2020

@ivanovmg ivanovmg requested a review from MarcoGorelli October 1, 2020 07:52
@ivanovmg ivanovmg mentioned this pull request Oct 1, 2020
5 tasks
@ivanovmg ivanovmg added the IO Data IO issues that don't fit into a more specific label label Oct 1, 2020
@ivanovmg ivanovmg changed the title BIG: fix inconsistent col spacing in info BUG: fix inconsistent col spacing in info Oct 1, 2020
Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't this dependent on the len(digits in number of columns)?

@ivanovmg
Copy link
Member Author

ivanovmg commented Oct 3, 2020

It is dependent, but the problem was that the width of the string with the column number is the actual width of the number + 1 space (Line 342 of the original file shows that line number string is prepended with a space). This PR fixes the problem and makes consistent spacing even when the number of columns is over 1000.

# add one space in max_id because there is a one-space padding
# in front of the number
# this allows maintain two spaces gap between columns
max_id = len(pprint_thing(col_count)) + 1
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this was starting playing role only when number of columns was over 1000. Because below 1000 max_id < len_id. Therefore below 1000 columns there were no issues.

@ivanovmg ivanovmg requested a review from jreback October 3, 2020 15:59
@jreback jreback added this to the 1.2 milestone Oct 7, 2020
@ivanovmg ivanovmg requested a review from jreback October 7, 2020 13:16
@jreback jreback merged commit 8e1cc56 into pandas-dev:master Oct 7, 2020
kesmit13 pushed a commit to kesmit13/pandas that referenced this pull request Nov 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
IO Data IO issues that don't fit into a more specific label
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: inconsistent spacing in df.info()
2 participants