-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Undesired UX behavior of DataFrame output in IPython Notebook #10231
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
Comments
Truncate wide HTML repr rather than changing format. Truncate HTML repr for DataFrames with MultiIndex-es Add tests for long & wide Dataframe HTML reprs Remove now-dead code for info display in HTML repr. Fix HTML repr of wide tables with named indices Make plain text repr follow HTML repr, truncating large DataFrames Fix up tests for string repr Update docs for DataFrame reprs Add an option to switch back to info repr for large DataFrames
Thanks for the clear documentation of the issue with the screenshots. I agree, we should fix this. |
Does IPython notebook cleanly handle horizontal scrolling when necessary if |
IIRC, in IPython 3 we put the output in its own scrollable container if it is wider than the notebook. In earlier versions, the page would just get wider, so the whole page would get a horizontal scrollbar. |
Indeed, I verified that I get the proper horizontal scrolling behavior in IPython 3. My only concern here is that IPython 3 may still be a little too new (3 months old) for us to change this -- we might break some folks still using earlier versions. On the other hand, upgrading IPython is pretty easy/seamless (in my experience). Any other thoughts here? |
@shoyer I tested using IPython 2.4.1 and pandas with |
At least it only makes the one output cell wider -- it could be far worst (e.g., the entire page gets stretched). For things like this, that work either way but are ugly for some users, I think we probably should make things nicer for users who are using the latest version of IPython. Of users who are using the latest version of pandas, a significant fraction are probably also keeping IPython up to date. So I think this change is a good idea. |
closed by #10232 |
I've encountered a bug which may be related which results in very strange multiple scrollbar behaviour with a particular csv dataset. This is with up to data Anaconda distribution on Windows - pandas 0.16.2 and Python 2.7.9 Unfortunately I wasn't able to generate the problem with a simple script, it occurs with the (anonymised) dataset at this link: https://www.dropbox.com/s/gdoow6ro8u7yn70/pandas%20multiple%20scrollbars%20bug.csv?dl=0 Steps to reproduce: open a new iPython notebook and paste the following code
|
@jeremybickerstaffe you didn't specify the ipython version. This is fixed in 0.16.2 for ipython >= 3.0.0. |
Thanks for responding @jreback |
I can't reproduce this with your file. Can you show the output of |
Sure, the output is:
|
Strange, I can't reproduce it with the same version of pandas and IPython. Which browser are you using? |
Chrome Version 44.0.2403.125 m (64-bit). It does appear to be very much an edge case (but very much repeatable for me - it affects lots of my files in this format). I found that bizarre changes, like changing the name of the file I put on Dropbox or changing the reading code to remove the assignment to 'df' this below can remove the rendering problem.
|
Ive had to use df.style to get scroll bars (vert/horz) |
From my previous line comment at be80898#commitcomment-11338872. cc @takluyver @jorisvandenbossche
Because DataFrame's
_repr_html_
returns hardcodeddiv
tag with stylemax-height:1000px
, if the height of DataFrame's output exceeds 1000px, it will generate a scroll bar.First, it is unnecessary because IPython Notebook has "toggle output scrolling" feature. Second, it causes UX problem if the height of browser resolution is below 1000px (user must scroll twice: the whole page and the generated div). Third, it can't make use of "toggle output scrolling" feature (if user turn it on, it will generate nested scroll bars (worse UX)). For more detailed explanations and examples, see the steps to reproduce below.
Pandas version: 0.16.1.
Steps to reproduce:
Open an IPython Notebook and paste this code. It will generate an inner scroll bar because the output's height exceeds 1000px.
If you want to see all rows, first you should scroll the page.

After you reach the bottom of the generated ouput's

div
, you should scroll again the inner scroll bar.If you want to toggle the IPython Notebook's "toggle output scrolling" feature, you get this.

Desired behaviors:
Solution:
Remove style property from
div
tag that DataFrame's_repr_html_
returns.Old:
<div style="max-height:1000px;max-width:1500px;overflow:auto;">\n
New:
<div>\n
Why should
max-width
be removed as well? Because it also generates far worse UX. If you have so many columns that the horizontal scroll bar generated, you cannot scroll it. You must refresh the page to be able to scroll it.The text was updated successfully, but these errors were encountered: