-
-
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: HTML styling for MI and notebook 5.0 #16080
COMPAT: HTML styling for MI and notebook 5.0 #16080
Conversation
Fixes the visual styling of MI labels in notebook 5.0
Codecov Report
@@ Coverage Diff @@
## master #16080 +/- ##
==========================================
+ Coverage 90.82% 90.82% +<.01%
==========================================
Files 159 159
Lines 50791 50797 +6
==========================================
+ Hits 46132 46138 +6
Misses 4659 4659
Continue to review full report at Codecov.
|
@TomAugspurger thanks! My main concern is that it may look a bit strange in certain cases if the header is left aligned and the values right-aligned (the example you show has consistent width columns, but that is not always the case) |
Yeah, that's unfortunate. I think that's worth the tradeoff for now though. I wasn't able to easily get any nice-looking vertical borders on just the columns of the MI that needed it. And I don't want to put in too much work, as ideally this code will be getting ripped out at some point (there's some IPython 2.x compatibility code in there 😆 ), but don't have time for that now. |
Yes, this is certainly already much better! |
Are you thinking to left-align always, or left-align only if there's a MI in the columns? I think there's no way to control the table body alignment based on the number of rows in the MultiIndex. I was only able to retain the default right-alignment for non-MI by using the only-child pseudo-selector. But this could only affect the column headers. I think I prefer the right-alignment in general, so it'd be a pity to lose that. |
Ah, yes, I was thinking: but we control the generation, so we can just change the style tag based on whether we are displaying a multi-index header or not. But of course, css doesn't work that way as it would change all tables in the notebook (unless we start adding unique identifiers as in .style)
OK, then let's leave it as is? we can always further refine later on if there comes feedback! |
Fixes the visual styling of MI labels in notebook 5.0 - No change to non-MI dataframes - Left-align MI columns - Top-align MI row labels
I think the code that was added here didn't just affect multiindex tables, but all tables. As a result, tables with long string values look awkward, with the row indices vertically top-aligned and values vertically middle-aligned. I have tried to fix this using custom css, but the css produced from this code overrides anything I try. |
@maxwasserman can you post what version version of the notebook you're using, and show before / after screenshots? Perhaps open a new issue so we can track it there. |
Fixes the visual styling of MI labels in notebook 5.0
Small summary:
Closes #15379