3

I am using pandas 1.5.3 in Flask. This code creates a sticky index column but not sticky column headers:

bigdf = pd.DataFrame(np.random.randn(100, 100))
dfhtml = bigdf.style.set_sticky(axis="index").set_sticky(axis="columns").to_html()
dfhtml = Markup(dfhtml)

Index column frozen You can see that the index column freezes when I scroll horizontally but the column headers don't freeze.

Weird thing is I have another DF in another identical environment with multi-index column headers it seems to work!

I have searched and found lots of comments on this problem associated with Jupyter notebooks. Am I missing something obvious?

2 Answers 2

2

This works, provided you have a sliding bar.

bigdf = pd.DataFrame(np.random.randn(20, 20))
bigdf.style.set_sticky(axis="index").set_sticky(axis="columns")

In my case, the vertical sliding bar can be toggled on and off by clicking on the left part of the cell (to the left of the index)

enter image description here

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you. And, I'm and idiot! I have a sticky navbar! It was working the whole time but frozen BEHIND the navbar. :( I just needed to make the th tag taller. :(
Glad you got it to work!
0

I'm and idiot! I have a sticky navbar! It was working the whole time but frozen BEHIND the navbar. :( I just needed to make the th tag taller. :(

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.