-
-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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: fix max_columns=0, close #2856 #2881
Conversation
@lodagro can you add a test for this? (I agree with your change...in fact tried to use it the other day!) |
@jreback test has been addded (both for max_rows and max_columns) |
@y-p if u would have a look |
terminal width detection only works in a proper shell/terminal situation, not IPython |
With Now, how are the options What about line_width=0, and use terminal width detection to set its value? |
I double-checked in case I was the one who got it wrong (it happens):
So I think expand_ should only affect wide frames, not all frames. It really has become a bit tangled. IMO, since terminal-width has proven Your PR suggests you want it back, so you'll have to handle the case maze .... :) I would suggest leaving everything as is (since there have been no cries from the balcony), |
Leaving everything as is, maybe not since Terminal size detection works fine, given that a terminal is used. Auto detect does e.g not work for the ipython notebook, qtconsole or IDLE. Way back auto detection on the width was the default, i think it was a good idea no longer to do this given the confusion it brought, but for someone how know the limitations of auto size detection it should still be possible to use it -- does this count as a cry from the balcony? :-) What about?: There are two ways to detect a wide frame (potentially both with auto width detection): and two ways to handle a wide frame: The way how to handle a wide frame is controlled by |
(**1)you're right, "Unreliable" terminal width, in that it reports the width of the terminal in which the two ways to detect wide frame, yes, but
That happens in if (**1) is removed, there's also a third case for the output |
@y-p both I have left the behaviour that if a frame repr exceeds bounds set by |
I saw this a while back but forgot to deal with it, |
We are clearly not in line on this, no problem we will converge :-) The place were you disagree on me using IMO terminal_width and terminal_height should only be used when requested by the user (either by setting max_columns, max_rows to zero, maybe also for line_width=0). I see no need to overrule the result returned from get_terminal_size. Now this is done for the qtconsole, it seems you also want to add a detection/overruling if the notebook is used. Even with those two in place there are other scenarios when get_terminal_size will not give the expected result. Why not leave it up to the user if he/she wants to use it. In this branch terminal_width/terminal_size is only used when either max_columns or max_rows is set to zero (yes it can be cleaned up). This is user controlled and we probably need to document the limitations of doing so, but i would leave it up to the user to make an informed decision. For me there is no need for qtconsole/notebook detection/overruling. We do need to handle interactive or not, since users complained about the repr info fallback when using pandas in non interactive mode, being it un-unix like. On master, not all repr info fallbacks are prevented, is that ok? Yes, it was spaghetti and i made it even worse, that is for later let us first converge on the desired behavior. By the way, df.to_string() has a In [1]: import pandas as pd
In [2]: len(repr(pd.DataFrame(123456, range(5), range(15))).split('\n')[1])
Out[2]: 92
In [3]: pd.options.display.max_columns = 1000
In [4]: len(repr(pd.DataFrame(0, range(5), range(35))).split('\n')[1])
Out[4]: 104 |
In [14]: pd.describe_option("line_width")
|
2013/3/28 y-p notifications@github.com
line_width ... When printing wide frames, this is the (max) width of each
|
currently, you're saying
|
Yes i would include Another point i am trying to make is that the output of get_terminal_size should only be used when either one of For me |
I'm +1 for:
This exposes an extra option but simpilifies the code a little, gives the user control to override |
I wrote the last before reading yours. Did I read correctly in that we agree? |
Yes we do agree, you are taking it one step further by exposing extra option - it makes perfect sense. |
Test suite fails. Can this make it into 0.11 with fixing? |
I think re this discussion it's supposed to change quite a bit from where it's at. |
Back around a computer. I will implement the discussed changes in one of the next days. |
Ok, i gave this a quick look - things should work as discussed now. Not yet finished, need to clean up and there is a failing test (test_large_frame_repr in pandas.tests.test_format.TestDataFrameFormatting), need to figure out what it is testing. |
Fixed the unit test. Thanks |
glups ... that was quick to merge, i wanted to shake it a bit, squash, doc strings are not updated yet. I`ll try to do it later on today. |
Would be good to have some mention of the new options and deprecations in |
#2856