Skip to content

BUG: max_colwidth controls data, not headers #7059

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
jreback opened this issue May 6, 2014 · 4 comments
Closed

BUG: max_colwidth controls data, not headers #7059

jreback opened this issue May 6, 2014 · 4 comments
Labels
Enhancement Output-Formatting __repr__ of pandas objects, to_string

Comments

@jreback
Copy link
Contributor

jreback commented May 6, 2014

statsmodels/statsmodels#1584

So should do something with the headers (maybe do a '....')

In [2]: df = DataFrame(1,index=range(2),columns=['short','really long'])

In [3]: df
Out[3]: 
   short  really long
0      1            1
1      1            1

[2 rows x 2 columns]

In [6]: with pd.option_context('display.max_colwidth',5):
   ...:     print(df)
   ...:     
   short  really long
0     1      1       
1     1      1       

[2 rows x 2 columns]

@jseabold
Copy link
Contributor

jseabold commented May 6, 2014

Just a thought and this is more of a related enhancement request, but it'd also be cool (for string columns and indices) to try to be smart when truncating to still give identifiable names. This is what stata does.

prrriiiiiiicccccccceeeeee
prrriiiiiiicccccccceeeeee2

becomes

prrriiiiii~e
prrriiiiii~2 

In truncated outputs.

@jreback
Copy link
Contributor Author

jreback commented May 6, 2014

hmm (as the '...' is pretty common for continuations)

prrriiiiii...e
prrriiiiii...2

@jseabold
Copy link
Contributor

jseabold commented May 6, 2014

Yeah, sure. I prefer the ellipsis just offering an example.

@mroeschke
Copy link
Member

Appears this hasn't gotten traction in a while so closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Output-Formatting __repr__ of pandas objects, to_string
Projects
None yet
Development

No branches or pull requests

3 participants