Skip to content
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

BUG: too much whitespace in truncated DataFrame repr leads to line overflow #24849

Closed
jorisvandenbossche opened this issue Jan 20, 2019 · 0 comments · Fixed by #24905
Closed
Labels
Bug Output-Formatting __repr__ of pandas objects, to_string
Milestone

Comments

@jorisvandenbossche
Copy link
Member

Example case from #22524 (comment) where the default repr is doing something wrong:

In [8]: import geopandas 
   ...: world = geopandas.read_file(geopandas.datasets.get_path('naturalearth_lowres')) 

In [9]: pd.options.display.max_columns = 0   # default

In [17]: world.head()                                                           
Out[17]: 
      pop_est                        ...                                                         
          geometry
0  28400000.0                        ...                          POLYGON ((61.2
1081709172574 35.65007233330923,...
1  12799293.0                        ...                          (POLYGON ((16.
32652835456705 -5.87747039146621...
2   3639453.0                        ...                          POLYGON ((20.5
9024743010491 41.85540416113361,...
3   4798491.0                        ...                          POLYGON ((51.5
7951867046327 24.24549713795111,...
4  40913584.0                        ...                          (POLYGON ((-65
.50000000000003 -55.199999999999...

[5 rows x 6 columns]

So it detects (probably correctly) that is can only show two columns in the current console width, but, then it adds so much white space between the two columns that it ends up being too wide. This results in an overflow of the lines, giving this very strange (and unclear) repr.

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
Projects
None yet
1 participant