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 and pandas MultiIndex issues #2408

Open
jorisvandenbossche opened this issue Apr 13, 2017 · 5 comments
Open

New table style and pandas MultiIndex issues #2408

jorisvandenbossche opened this issue Apr 13, 2017 · 5 comments

Comments

@jorisvandenbossche
Copy link
Contributor

Follow-up issue on #2209, but I thought better to open a new issue.
There are still some aspects where the new table style does not play very nice with pandas generated tables, more specifically with MultiIndexes

See also the comments in the pandas issue pandas-dev/pandas#15379 (comment), but the main point is that the default alignment of the headers in the new table style makes the interpretation of a table with MultiIndexes (or in general multiple header rows) somewhat confusing:

  • multi-row column headers: due to the right-alignment instead of left alignment, multi-indexed columns get a bit strange:

    screenshot from 2017-02-28 16-07-58

    I don't directly know a way to solve this in a html/css way while keeping the right alignment. In the above case, I think we would ideally want 'A' to be above 'a' ? (which is not the same as left aligning it)
    Anybody an idea about this?

  • multiple row headers: 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:

    screenshot from 2017-02-28 16-08-18

    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):

    screenshot from 2017-02-28 16-09-01

    This could be rather easily solved with 'vertical-align: top', which looks better in this case:

    screenshot from 2017-02-28 17-00-34

    But the question of course is whether this will look better in general cases as well. And whether this is something that could be changed in the default jupyter styles? Other option is that pandas includes this in the html output, which would also not be that difficult.

@takluyver
Copy link
Member

Ping @ellisonbg

@ellisonbg
Copy link
Contributor

I am fine trying this out. I think the main take home I have from this redesign is that it is going to be really difficult to satisfy every usage case with a single table style. This design, while being used by Pandas, it designed to be completely generic and general. This particular change may be fine to use in general, but I think if Pandas wants to do custom things, they should push HTML with inline styles that modify needed things. This is especially true with all the complexities of nested indices.

@rgbkrk
Copy link
Member

rgbkrk commented Apr 14, 2017

Just a little anecdote from our deployment of Notebook v5 at Netflix -- there have been people that love the new table style, especially when they have many columns from a query. I was surprised because I found it too small to read.

@TomAugspurger
Copy link

FYI, we're handling this on the pandas side at pandas-dev/pandas#16080 if anyone has any feedback.

@billtubbs
Copy link

Hi everyone. Has this problem come back in the latest version?

Code to reproduce

midx = pd.MultiIndex.from_product([['A', 'B'], ['a', 'b', 'c']])
df = pd.DataFrame(np.random.randn(5, len(midx)), columns=midx)

1. Older version

jupyter_client : 7.4.9
jupyter_core : 5.3.0

Screen Shot 2023-09-30 at 12 01 28

2. Newer version

jupyter_client : 8.3.0
jupyter_core : 5.3.1

Screen Shot 2023-09-30 at 12 06 39

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants