-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Applying max_colwidth to the DataFrame index (#7856) #8954
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
Conversation
justification to comply with tests
needs a test |
I have added a test case. Tell me if you want anything changed, or if anything is missing. I will do a final squash when everything is up to standard. |
@jorisvandenbossche I now have time time to finalize this. I have merged with the current head. If there is still interest in dealing with this issue just say. I could imagine that there is still a few things to do (like adding an entry to whatsnew)... |
@tiagoantao Certainly interest! Remark on the test: I don't think it is testing the correct thing (but you can also leave it in as it is now for testing the width of the columns), as it is testing the width of the columns which is already working. You can eg set some columns as the index, and then test again. That is what now is failing:
|
@@ -4795,6 +4795,22 @@ def test_repr_unicode(self): | |||
result = repr(df) | |||
self.assertEqual(result.split('\n')[0].rstrip(), ex_top) | |||
|
|||
def test_str_max_colwidth(self): | |||
curr_max_colwidth = pd.get_option('max_colwidth') | |||
# As we change a global option, we save it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pls add the issue number as a comment here
pls add a release note that explains this. if you can do this asap i can put in 0.16.0 |
And the test needs an addition, see my comment above. |
I will do this over the weekend. On 6 March 2015 at 09:21, Joris Van den Bossche [email protected]
When the senses are shaken, and the soul is driven to madness, Who can |
I have tried to sort this out. My sincere apologies for the delay. I will be monitoring this during the next day or so. I will try to react as fast as possible if you find anything in need of intervention. |
'd': 1}, | ||
{'a': 'foo', 'b': 'bar', 'c': 'stuff', 'd': 1}]) | ||
df.set_index(['a', 'b', 'c']) | ||
assert(str(df) == ' a b c d\n' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use self.assertTrue(.....)
instead of bare assert
Did all the corrections. I just hope the way I committed (i.e. in terms of logs and squash) is acceptable. My git-fu is a bit substandard. I apologize for all these mistakes. I hope in the future, with this experience, I am able to do a few contributions will less noise. |
merged via e4cb0f8 thanks! |
closes #7856
reports a problem with the application of max_colwidth to groupby.
The real problem is that max_colwidth is not applied to the index. This patch solves that.
I am not applying self.justify to the formatting of the index (as that would break a test). But maybe it makes more sense to change the test?