Skip to content

BUG: Fix set_sticky background #47082

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

Merged
merged 1 commit into from
May 26, 2022
Merged

Conversation

ShawnZhong
Copy link
Contributor

@ShawnZhong ShawnZhong commented May 21, 2022

Inherit the background-color of the sticky elements from its parents (with proper color alternation between rows) instead of hard-coding it to white.

Example:

import pandas as pd
import numpy as np

pd.DataFrame(np.random.randn(16, 100)).style.set_sticky()
Dark Light
image image

For reference, #42072 introduced the set_sticky feature.

@ShawnZhong ShawnZhong changed the title Fix set_sticky background BUG: Fix set_sticky background May 21, 2022
@rhshadrach rhshadrach added the Styler conditional formatting using DataFrame.style label May 21, 2022
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.

can you add a note for this, 1.5, styler section

@jreback jreback added this to the 1.5 milestone May 21, 2022
@jreback
Copy link
Contributor

jreback commented May 21, 2022

cc @attack68

@attack68
Copy link
Contributor

This is the best solution. LGTM

@mroeschke
Copy link
Member

mroeschke commented May 26, 2022

LGTM, failure unrelated. Needs approval from @jreback to merge.

@mroeschke mroeschke merged commit adc9830 into pandas-dev:main May 26, 2022
@mroeschke
Copy link
Member

Thanks @ShawnZhong

@ShawnZhong ShawnZhong deleted the set_sticky branch May 26, 2022 18:33
yehoshuadimarsky pushed a commit to yehoshuadimarsky/pandas that referenced this pull request Jul 13, 2022
@byrdie
Copy link

byrdie commented Apr 22, 2023

I think this PR introduced a bit of a regression since it makes the background of the sticky row/column transparent, which makes it harder to read once you scroll to right/down.

You can see the behaviour in the current docuemntation
https://pandas.pydata.org/docs/user_guide/style.html#Sticky-Headers

@attack68
Copy link
Contributor

I think regression is too strong a word for this item, but generally I agree. The underlying issue was reopened and remains outstanding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Styler conditional formatting using DataFrame.style
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: Style.set_sticky() doesn’t work with dark mode
6 participants