Skip to content

Unintuitive default behavior with wide DataFrames in the IPython notebook #3573

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
wesm opened this issue May 11, 2013 · 8 comments
Closed
Labels
Bug Output-Formatting __repr__ of pandas objects, to_string
Milestone

Comments

@wesm
Copy link
Member

wesm commented May 11, 2013

In the IPython notebook, HTML output it the default and whether summary view is displayed should not be governed by hypothetical line width. I ran into this problem in a demo recently and it took me a minute to figure out what was wrong, definitely a bad change in 0.11.

@wesm
Copy link
Member Author

wesm commented May 11, 2013

cc @michaelaye

@jreback
Copy link
Contributor

jreback commented May 20, 2013

@y-p @lodagro you guys looking at this?

@ghost
Copy link

ghost commented May 20, 2013

wes, sorry to hear you had a snafu in front of an audience.

The updated behaviour has a consistent story and took a lot of noodling to make
sure it behaved sanely under a substantial number of corner cases.

It seems the end result of that is crappy UX from your POV. Disappointing
to hear considering how little fun I had trying to make it work.

An easy fix is to just set the width to something large on ipnb by default.
To let users opt in to activating the limit rather then loosening it.

That code doesn't need more special cases, it really does not,
I agree that consideration is trumped by UX though.

@ghost
Copy link

ghost commented May 20, 2013

PR pending.

@wesm
Copy link
Member Author

wesm commented May 20, 2013

Sorry @yp I didn't mean to put down your work which is definitely much appreciated. Satisfying many concerns simultaneously is not an easy thing. It was just basically "this used to print out fine in the notebook without any option-tweaking, what happened?" -- the fix could actually be just to always print the full-width HTML repr whenever the table is under max_rows and that could get put all here in the ipython hook:

    def _repr_html_(self):
        """
        Return a html representation for a particular DataFrame.
        Mainly for IPython notebook.
        """
        if com.in_qtconsole():
            raise ValueError('Disable HTML output in QtConsole')

        if get_option("display.notebook_repr_html"):
            if self._need_info_repr_():
                return None
            else:
                return ('<div style="max-height:1000px;'
                        'max-width:1500px;overflow:auto;">\n' +
                        self.to_html() + '\n</div>')
        else:
            return None

@ghost ghost mentioned this issue May 21, 2013
@lodagro
Copy link
Contributor

lodagro commented May 21, 2013

@y-p enough is enough ... apparently not :-), very brave of you to tackle this once more. Our idea of a double bounding box (display width/height and object data shape) was/is not really a success. Maybe the unintuitive part is that by default they are both active. I hope your changes will resolve the confusion.

@ghost
Copy link

ghost commented May 21, 2013

Thanks @lodagro, lessons learned and all that.

@wesm
Copy link
Member Author

wesm commented May 25, 2013

fixed by #3663, thanks @y-p

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

3 participants