Skip to content

Repeat headings every n-th row in Jupyter-lab notebook #28091

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

Closed
wants to merge 2 commits into from

Conversation

elisamalzoni
Copy link

Adds a new option in pd.set_option() method.

Usage:

# n is an int that represents the interval of rows which the headers are repeated (default = 0, no repetition)
pd.set_option("display.repeating_row_index", n)   
Before After (n = 3)
Imgur Imgur

@Leostayner

@pep8speaks
Copy link

pep8speaks commented Aug 22, 2019

Hello @elisamalzoni! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2019-08-22 14:55:02 UTC

@TomAugspurger
Copy link
Contributor

Hmm, I'm not entirely sure about this. It doesn't mesh well with my idea of an HTML table.

If we proceed, we'd need tests, and we would need to handle it similar to the other options (a parameter that gets plumbed through from DataFrame.to_html down to the formatter, and looked up from the config if not specified)

@simonjayhawkins simonjayhawkins added API Design IO HTML read_html, to_html, Styler.apply, Styler.applymap Output-Formatting __repr__ of pandas objects, to_string labels Aug 25, 2019
@simonjayhawkins simonjayhawkins changed the title Fixes issue #27563 Repeat headings every n-th row in Jupyter-lab notebook Aug 25, 2019
@WillAyd
Copy link
Member

WillAyd commented Aug 25, 2019

Yea I think this is a little arbitrary. From the linked issue I get the problem we are trying to solve is that the headers aren't visible while scrolling through. Wouldn't it be possible to just pin the headers then with appropriate CSS?

cc @simonjayhawkins for insights

@simonjayhawkins
Copy link
Member

I do think that this could be out-of-scope for pandas. presumably, it's an issue for any application/library display HTML in the notebook and the issue should be raised there?

@simonjayhawkins
Copy link
Member

@elisamalzoni will look in detail, but on initially glance suspect that this may have issues with a multiIndex because of rowspan. Changes to _write_hierarchical_rows would also be needed. Can you add a test for this?

Copy link
Member

@gfyoung gfyoung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that pinning is a preferable option to resolving this issue.

@WillAyd
Copy link
Member

WillAyd commented Aug 26, 2019

Thanks all for the input. Given there doesn't appear to be a lot of appetite for this from the maintainers I think going to close, but @elisamalzoni appreciate for sure the effort on this and would welcome that on any other issues out there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Design IO HTML read_html, to_html, Styler.apply, Styler.applymap Output-Formatting __repr__ of pandas objects, to_string
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pandas - Repeat headings every n-th row in Jupyter-lab notebook
6 participants