Skip to content

separate sparsify for header and body #11987

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
youlyst opened this issue Jan 7, 2016 · 8 comments
Closed

separate sparsify for header and body #11987

youlyst opened this issue Jan 7, 2016 · 8 comments
Labels
Closing Candidate May be closeable, needs more eyeballs Enhancement IO HTML read_html, to_html, Styler.apply, Styler.applymap

Comments

@youlyst
Copy link

youlyst commented Jan 7, 2016

hi
i would welcome if option sparsify could be set separately for header and body
as i want body without sparsify=False and head with sparsify=True
what do you think about it?

@jreback
Copy link
Contributor

jreback commented Jan 7, 2016

pls show an example of what you mean

@youlyst
Copy link
Author

youlyst commented Jan 7, 2016

i mean sparsify parameter in DataFrameto_html
df.to_html(sparsify_head=True, sparsify_body=False)

@jreback
Copy link
Contributor

jreback commented Jan 7, 2016

not sure what this would mean. can you show an example.

@jreback jreback added Output-Formatting __repr__ of pandas objects, to_string IO HTML read_html, to_html, Styler.apply, Styler.applymap labels Jan 7, 2016
@youlyst
Copy link
Author

youlyst commented Jan 7, 2016

if i well understand doc string
sparsify : bool, optional Set to False for a DataFrame with a hierarchical index to print every multiindex key at each row, default True
each row means that above aplies also on columns
so it is imposible to handle use case with i.e to sparsify only columns in html header, and not rows index

so maybe sparsify could be integer instead of bool, and it will allow to hold choices like:
0 - dont sparsify at all
1 - sparsify only header
2 - sparsify only body
3 - sparsify both header and body

@jreback
Copy link
Contributor

jreback commented Jan 7, 2016

xref #11610

@youlyst I am inclined to have this done thru the new .style interface which allows customization of html repr. .to_html will use this at some point.

cc @TomAugspurger

@TomAugspurger
Copy link
Contributor

Yeah I've been working on sparsify a bit. Should have something next week.

@attack68 attack68 added the Styler conditional formatting using DataFrame.style label Mar 31, 2021
@mroeschke mroeschke removed Output-Formatting __repr__ of pandas objects, to_string Styler conditional formatting using DataFrame.style labels Apr 21, 2021
@attack68
Copy link
Contributor

attack68 commented Sep 9, 2021

df.style.to-html can already do this. perhaps will extend to df.to-html when the redirection is in place.

@attack68 attack68 added the Closing Candidate May be closeable, needs more eyeballs label Sep 9, 2021
@mroeschke
Copy link
Member

Closing as this feature is available in Styler

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Closing Candidate May be closeable, needs more eyeballs Enhancement IO HTML read_html, to_html, Styler.apply, Styler.applymap
Projects
None yet
Development

No branches or pull requests

5 participants