Skip to content
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

New table style makes it impossible to view data (5.0 beta) #2209

Closed
jorisvandenbossche opened this issue Feb 20, 2017 · 13 comments · Fixed by #2231
Closed

New table style makes it impossible to view data (5.0 beta) #2209

jorisvandenbossche opened this issue Feb 20, 2017 · 13 comments · Fixed by #2231

Comments

@jorisvandenbossche
Copy link
Contributor

I know this has been raised and discussed before (jupyterlab/jupyterlab#961, jupyterlab/jupyterlab#910 (comment), and actually the max-width has been increased due to that discussion), but, with the risk of trolling, I would like to raise this again (and opening an issue here instead of at jupyterlab, as with the 5.0 beta it seems more urgent here).
To be clear: I really like the new table style! My only concern is regarding the hard-coded max-width and hiding of data.

Problem: due to the hard-coded max-width: 150px combined with white-space: nowrap, actual data gets hidden without any alternative way to look at the actual data.
For me, the notebook is for a large part about "interacting with my data". An essential aspect of this, just looking at what is in my dataframe, is now impossible once you have a bit longer cell contents.

And you very easily get to this limit of 150px, eg timestamps with subsecond digits (common in certain fields), a bit longer species names, review comments, ...

Possible solution: My preferred solution would be to rework this part of the table styling to always display all provided data (and there are some different options to obtain this, like no max-width, or a max-width but with text wrapping over multiple lines, ...)
Other way of putting it is this principle: let the library that generates the table control what data is visible, and let jupyter just display it 'unopinionated'.

As I said, the above is my preferred solution because this would let pandas (and other libraries generating tables) be able to control what is actually displayed (as we already currently do with pd.options.display.max_colwidth).
But of course, there can also be other solutions like:

  • make this easily configurable from jupyter
  • display full data on hover
  • ..

To be clear: it doesn't has to be my provided solution, but at least I hope you are open to reconsidering this aspect of the table styling (irregardless of the outcome of the discussion in the end :-)).


Note: we can override this from the pandas side, by including a style tag with every generated table. Relevant issue is here: pandas-dev/pandas#15379 (and we would consider a bug-fix 0.19.3 release if necessary).
I will put some illustration of the interaction of pandas with the new table style in a next comment.

@takluyver takluyver added this to the 5.0 milestone Feb 20, 2017
@takluyver
Copy link
Member

Milestoned for 5.0 so we at least have a look at it, but I don't want this to hold the release up if it becomes the last thing.

Pinging @ellisonbg for style question.

@jorisvandenbossche
Copy link
Contributor Author

jorisvandenbossche commented Feb 20, 2017

Illustration of the interaction with pandas.

In the current notebook 4.x, by default pandas limits the amount of data represented in html table, so you still get a limited column width by default.
But, if you really want to look at the actual full data, there is an option you can use to change this:

screenshot from 2017-02-20 12-36-50

Now the same example with notebook 5.0 beta. The default repr of the dataframe is rather similar (it is bit shorter as the default of pd.options.display.max_colwidth (see above), but the default of the pandas setting can certainly be discussed).
So up to here, everything is OK. But now, if you want to look at the actual data, the pandas option no longer works. And there is also no alternative way to look at the actual data (apart from looking at the underlying array using df.values, but this looses the labeled aspect and nice formatting of the pandas table):

screenshot from 2017-02-20 12-37-12

So as a conclusion: I agree the default should not be to display all data, but to have a limited column width. But, from the pandas point of view, it would be better to let pandas control this instead of jupyter.

@ellisonbg
Copy link
Contributor

ellisonbg commented Feb 20, 2017 via email

@takluyver
Copy link
Member

Ping @ellisonbg

@ellisonbg
Copy link
Contributor

ellisonbg commented Feb 23, 2017 via email

@takluyver
Copy link
Member

@jorisvandenbossche since you've looked into this, do you want to do a PR?

@jorisvandenbossche
Copy link
Contributor Author

@ellisonbg Thanks for reconsidering this!
@takluyver I could try that (although I don't know much about css), but, there are still some design decisions to take:

Just removing the max-width is not what we want I think:

screenshot from 2017-02-24 16-01-48

So combining with resetting whitespace as well:

screenshot from 2017-02-24 16-02-44

Now, the line height seems a bit too small. However, resetting that as well is maybe too much space between the rows?

screenshot from 2017-02-24 16-04-39

I could decrease the padding a bit (currently 0.5em 0.5em), but that seems rather arbitrary:

screenshot from 2017-02-24 16-25-41

@ellisonbg
Copy link
Contributor

ellisonbg commented Feb 24, 2017 via email

@takluyver
Copy link
Member

As we're trying to get to 5.0 soon, do we want to make a less carefully designed change to make this 'good enough' for now? E.g. remove max-width and reset whitespace so long lines can wrap? We can always make further improvements for 5.1.

@jorisvandenbossche
Copy link
Contributor Author

@ellisonbg the notebook I used to make the screenshots above: http://nbviewer.jupyter.org/gist/jorisvandenbossche/884d4370577d47ad9583f1381fcc01cc

I was mainly using jupyterlab to test this out, but I raised it here as the notebook release seemed more imminent. But discussing it further in jupyterlab is fine for me as well.

@ellisonbg
Copy link
Contributor

ellisonbg commented Feb 26, 2017 via email

@ellisonbg
Copy link
Contributor

ellisonbg commented Feb 26, 2017 via email

@tomweber-sas
Copy link

Hey guys, sorry to barge in. I'm wondering what to do about this for my problem (ipython#11033 right above). My code returns complete HTML5 documents which can contain svg graphics, embedded tables and any other html elements. It contains css already too. This has all been working for years in jupyter notebooks but recently is broken due to (it seems) this fixed width table display change. Curiously, displaying wide dataframes still has the scrollbar and the column headers aren't overlapped.

Here's a picture of the problem. I also have a customer who see data values overlap too. This case just happens to be the column names.
image

Is there any kind of a fix for this or a work around I can implement in my code? Basically I use IPython.display to render via: display(HTML(mydocument))

Thanks for any help!
Tom

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants