-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
Compat with jupyter's new HTML table style #15379
Comments
The overriding can be done by adding the following style to each
Other options could be:
|
Another issue is that, IMO, we should keep some kind of wrapping long text in multiple lines, see eg the notebook here: http://nbviewer.jupyter.org/gist/epifanio/e82443b79c24ceb2d59ba49cad9a62d4 (from gitter). |
In the meantime, my proposal to remove the max-width in jupyter has been accepted, so we can close this issue! We can still adjust our |
Reopening this because there are some other issues we have to think about as well. What I encountered now are the display of MultiIndexes: Due to the right-alignment instead of left alignment, multi-indexed columns get a bit strange: Also multi-indexer rows are not ideal because the distinction between the levels is not always clear (the borders are gone, but the shading does not always differ depending on the number of rows in the level). In this case, that is OK: But in the following the shading is the same (and certainly when having more rows in one level label, or different number of rows for different labels, it becomes difficult to see the border between the level labels): |
Good catch. Would we be better of vertical-aligning the row MultiIndex? We'll also want to check the interaction with index-level names (I'm getting caught up on things, should have more time to look myself towards the end of the week). |
For the row multi-index, vertical alignment to the top seems better: The strange thing is that I see |
I s there any option to disable the default styling .. basically i want to roll back to previous default settings.. |
You can try asking on their mailing list. There's probably a way with custom CSS, but nothing pandas would do.
… On Apr 13, 2017, at 00:08, Jagdish Chandra Joshi ***@***.***> wrote:
I s there any option to disable the default styling .. basically i want to roll back to previous default settings..
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
For the MultiIndex issues (from the above comments), I opened an issue on the jupyter side: jupyter/notebook#2408 (and ideas what would be the best solution for the multi-indexed columns is also welcome ..) |
@TomAugspurger any ideas what we could do for the multi-index columns? |
Looking now. I think we'll need to adjust the generated HTML to add some classes to the |
OK, putting together a PR now. Here's an example notebook comparing master and the PR https://gist.github.com/79f032afa4e498f86a9d59905d0f6fbd Changes:
|
@TomAugspurger I have noticed that MultiIndex row labels are top-aligned in the default display, but are middle-aligned when used with compared with I find the top aligned row labels much easier to read (although I can see the appeal of the middle-aligned labels). Is there a way to get top-aligned labels when using |
Probably by adding the right CSS to the table attributes. You could
probably look at the CSS for the default repr_html, and adjust the
selectors.
…On Fri, Feb 22, 2019 at 9:38 PM Donna Calhoun ***@***.***> wrote:
@TomAugspurger <https://github.com/TomAugspurger> I have noticed that
MultiIndex row labels are top-aligned in the default display, but are
middle-aligned when used with DataFrame.style.format(). For example :
[image: image]
<https://user-images.githubusercontent.com/1406529/53281165-4f732b00-36e1-11e9-9e18-834661beb557.png>
compared with
[image: image]
<https://user-images.githubusercontent.com/1406529/53281174-73367100-36e1-11e9-954d-9dfc20716130.png>
I find the top aligned row labels much easier to read (although I can see
the appeal of the middle-aligned labels). Is there a way to get top-aligned
labels when using style.format ?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#15379 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABQHIrbBNt-C5A2AWnA0Rd2T70dHW413ks5vQLfLgaJpZM4L-jrJ>
.
|
On your hint, I looked at what
Looks like I need to set
But this didn't work. I must be missing something on how to set these properties. |
I just tried the following:
which works. It isn't obvious how to make a more global change, though.
|
I think we have an open issue for exporting styles globally.
…On Fri, Feb 22, 2019 at 11:44 PM Donna Calhoun ***@***.***> wrote:
I just tried the following:
th_prop = {"selector":"th", "props":[("vertical-align","top")] }
df.style.format('{:.2f}'.format).set_table_styles([th_prop])
which works. It isn't obvious how to make a more global change, though.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#15379 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABQHIpdjlLqdVOSzVOJwBcA2tMhW2W2uks5vQNUhgaJpZM4L-jrJ>
.
|
Any news on this issue, or a related one? I still wonder why a simple |
See also discussion in jupyterlab/jupyterlab#961
With the upcoming notebook 5.0 release and in current jupyterlab, jupyter has a new (much better!) default HTML table styling. The only problem is that it fixes the width of columns hardcoded at 150 px.
IMO this is a problem. Not the default as such, but the fact that you cannot easily change this when you want to see long table content. The result is that when having cells/column names with long content (and sometimes you deliberately create such cells/column names), it is impossible to inspect those data with the default repr.
Only solutions are to inspect specifics such as
df.values
ordf.columns
.Another consequence is that the
pd.options.display.max_colwidth
option becomes useless.Possible way forward:
max-width
for our html repr's to set it to 'none' (@TomAugspurger shows here that this is possible: New table style truncates columns jupyterlab/jupyterlab#961 (comment))pd.options.display.max_colwidth
(currently 50 chars) at the same time. The the default looks similar to jupyter's one, but you have still the ability to adjust it with our options.The text was updated successfully, but these errors were encountered: