Skip to content

line_width failure #3201

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
lodagro opened this issue Mar 28, 2013 · 2 comments
Closed

line_width failure #3201

lodagro opened this issue Mar 28, 2013 · 2 comments
Labels
Bug Output-Formatting __repr__ of pandas objects, to_string
Milestone

Comments

@lodagro
Copy link
Contributor

lodagro commented Mar 28, 2013

Two examples where line_width display option requirement is not met:

In [1]: import pandas as pd

In [2]: pd.__version__
Out[2]: '0.11.0.dev-250c8e0'

In [3]: len(repr(pd.DataFrame(123456, range(5), range(15))).split('\n')[1])
Out[3]: 92

In [4]: pd.options.display.max_columns = 100

In [5]: len(repr(pd.DataFrame(0, range(5), range(35))).split('\n')[1])
Out[5]: 104
@ghost
Copy link

ghost commented Mar 28, 2013

https://github.com/pydata/pandas/blob/master/pandas/core/frame.py#L619
max_columns is compared against the number of frame columns, not terminal columns ("width").

max "terminal columns" is controlled by terminal_width, which is only known when
working in a textual terminal.

@lodagro
Copy link
Contributor Author

lodagro commented Mar 28, 2013

This is a df.to_string() issue, the code you are referring too is not in play here.

In [33]: df = pd.DataFrame(0, range(5), range(35))

In [34]: s = df.to_string(line_width=80)

In [35]: print s
   0   1   2   3   4   5   6   7   8   9   10  11  12  13  14  15  16  17  18  19  20  21  22  23  24  \
0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
1   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
2   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
3   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
4   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   

   25  26  27  28  29  30  31  32  33  34  
0   0   0   0   0   0   0   0   0   0   0  
1   0   0   0   0   0   0   0   0   0   0  
2   0   0   0   0   0   0   0   0   0   0  
3   0   0   0   0   0   0   0   0   0   0  
4   0   0   0   0   0   0   0   0   0   0  

In [36]: lines = s.split('\n')

In [37]: len(lines[1])
Out[37]: 104

In [38]: max(len(line) for line in lines)
Out[38]: 104

wesm added a commit that referenced this issue Apr 10, 2013
BUG: take into account adjoin width, closes #3201
wesm added a commit that referenced this issue Apr 10, 2013
* 'master' of github.com:pydata/pandas:
  BUG: take into account adjoin width, closes #3201
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
Development

No branches or pull requests

1 participant