Skip to content

BUG: categorical doesn't handle display.width of None in Python 3 (GH10087) #10108

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
May 12, 2015

Conversation

rosnfeld
Copy link
Contributor

closes #10087

I think this is fairly straightforward, however I am not sure if the prior code comparing display.width to 0 was correct... is display.width ever supposed to be set to 0? It looks suspiciously similar to a snippet from Series.__unicode__(), but that is looking at display.max_rows. Maybe it was brought over incorrectly?

If it should just be a simple comparison to None, not 0 as it was before, just let me know and I'll amend this.

max_width = (width if get_option("display.width") == 0
else get_option("display.width"))
display_width = get_option("display.width")
max_width = (width if (display_width == 0 or display_width is None)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can just do width or display_width or 80 (to assure its never 0/None)

@jreback jreback added Bug Output-Formatting __repr__ of pandas objects, to_string 2/3 Compat labels May 11, 2015
@jreback jreback added this to the 0.17.0 milestone May 11, 2015
@rosnfeld
Copy link
Contributor Author

I think my git skills have gone rusty. I am trying to amend my commit, but it doesn't like that I have already pushed it - it won't accept my new (amended) push, saying I am behind the remote counterpart. But the remote just has the changes before the amended commit. Any hints?

@rosnfeld
Copy link
Contributor Author

I just forced the push. Not sure if there was any better way.

At any rate, I incorporated most of your comment. I think 0 is a valid value, as it's checked against in code below. Thanks for your feedback!

@shoyer
Copy link
Member

shoyer commented May 12, 2015

@rosnfeld Yes, you need to force if you amend a commit.

@rosnfeld
Copy link
Contributor Author

Ok, good to know - thanks.

@jreback Travis is happy if you're happy (with this change).

jreback added a commit that referenced this pull request May 12, 2015
BUG: categorical doesn't handle display.width of None in Python 3 (GH10087)
@jreback jreback merged commit ef23df1 into pandas-dev:master May 12, 2015
@jreback
Copy link
Contributor

jreback commented May 12, 2015

@rosnfeld thanks! hope this exercised those git skills! maybe need another PR to work on that :)

@rosnfeld rosnfeld deleted the issue_10087 branch May 12, 2015 18:45
@jorisvandenbossche jorisvandenbossche modified the milestones: 0.17.0, 0.16.2 Jun 2, 2015
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.

BUG: categorical doesn't handle display.width of None in Python 3
4 participants