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

ENH: add styler option context for sparsification of columns and index separately #41512

Merged
merged 9 commits into from
May 21, 2021

Conversation

attack68
Copy link
Contributor

@attack68 attack68 commented May 16, 2021

This PR closes #41142.

It adds a new pandas.options context for Styler (see #41395), and create the sparse.index and sparse.columns options, defaulting to True.

It also allows a keyword application for sparsification via the .render method, (this might not really be necessary: opinion welcome)

  • tests added for kwarg application and option context

@simonjayhawkins simonjayhawkins added Enhancement IO HTML read_html, to_html, Styler.apply, Styler.applymap IO LaTeX to_latex labels May 17, 2021
Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

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

didn't look except for first comment

@@ -482,6 +482,11 @@ plotting.backend matplotlib Change the plotting backend
like Bokeh, Altair, etc.
plotting.matplotlib.register_converters True Register custom converters with
matplotlib. Set to False to de-register.
styler.sparsify_index True "Sparsify" MultiIndex display for rows
Copy link
Contributor

Choose a reason for hiding this comment

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

we had a discussion a while back about nesting display.styler..... (e.g. as we do display.html), but maybe this was to move .html to the top level, this is prob better

consider styler.sparse.index

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i think having its own context is useful for what follows. I have changed to your consideration.

@attack68 attack68 requested a review from jreback May 17, 2021 22:01
@jreback jreback added this to the 1.3 milestone May 21, 2021
@jreback jreback merged commit e5f1f9c into pandas-dev:master May 21, 2021
@jreback
Copy link
Contributor

jreback commented May 21, 2021

great thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement IO HTML read_html, to_html, Styler.apply, Styler.applymap IO LaTeX to_latex
Projects
None yet
Development

Successfully merging this pull request may close these issues.

API: refactor Styler to allow sparse cols or index separately.
3 participants