Skip to content

Fixed to_string with line_width and without index #13998

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

Merged
merged 1 commit into from
Aug 15, 2016
Merged

Fixed to_string with line_width and without index #13998

merged 1 commit into from
Aug 15, 2016

Conversation

cr3
Copy link
Contributor

@cr3 cr3 commented Aug 14, 2016

When calling to_string on a DataFrame with line_width, this calls
_join_multiline internally which only sets the idx variable when
index is True, otherwise idx is never set resulting in the error:

UnboundLocalError: local variable 'idx' referenced before assignment

@codecov-io
Copy link

codecov-io commented Aug 14, 2016

Current coverage is 85.27% (diff: 100%)

Merging #13998 into master will increase coverage by <.01%

@@             master     #13998   diff @@
==========================================
  Files           139        139          
  Lines         50211      50212     +1   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits          42819      42820     +1   
  Misses         7392       7392          
  Partials          0          0          

Powered by Codecov. Last update 5f49638...e0b1840

@jorisvandenbossche
Copy link
Member

@cr3 Thanks!
Can you add a small whatsnew notice (in docs/source/whatsnew/v0.19.0.txt, in the bug fixes section)

Also, I noticed line_width is not mentioned in the to_string docstring. Would you like to add an explanation for that as well?

@jorisvandenbossche jorisvandenbossche added Bug Output-Formatting __repr__ of pandas objects, to_string labels Aug 15, 2016
When calling to_string on a DataFrame with line_width, this calls
_join_multiline internally which only sets the idx variable when
index is True, otherwise idx is never set resulting in the error:

  UnboundLocalError: local variable 'idx' referenced before assignment
@cr3
Copy link
Contributor Author

cr3 commented Aug 15, 2016

@jorisvandenbossche, thanks for the suggestion, I rebased my branch with both your suggestions. To be pedantic, I'm not sure if the description of line_width in the docstring should start with an upper or lower case character; the first descriptions in the docstring used lower case and the last ones used upper case, so I decided to be consistent with the last ones.

@jorisvandenbossche
Copy link
Member

To be pedantic, I'm not sure if the description of line_width in the docstring should start with an upper or lower case character

No problem, I like that :-) Well, I think it should start with upper case, but we indeed do not follow this rigourously in the code base.

@jorisvandenbossche jorisvandenbossche added this to the 0.19.0 milestone Aug 15, 2016
@jorisvandenbossche jorisvandenbossche merged commit ef61beb into pandas-dev:master Aug 15, 2016
@jorisvandenbossche
Copy link
Member

@cr3 Thanks!

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

Successfully merging this pull request may close these issues.

3 participants