Hey! I love streamlit’s built-in dataframe for many obvious reasons:
- Responsive for desktop & mobile
- You can always see column names & index names even when scrolling around
- Allows me to display my fancy dataframes with minimal headache
Background: I work in an industry that’s super opinionated on formatting its tables. Using pandas built-in styling, I’m able to achieve 99% of my needs (highlighting subtotals, formatting negatives with parentheses, all that jazz). However, all this pandas styling only applies to the values of the dataframe and not the index/column headers.
Request: Has anyone figured out a way to style the index & column header as well? Perhaps the below example highlights my issue. I’d like to make “Total UCF” dark grey as I’ve already done with pandas styling. And I’d also like to make the headers “Entry, 2018, 2019,” etc. dark blue & bold with white font. Any ideas?! (actual figures hidden b/c confidential)
I can (& have) achieved this with plotly tables. But they’re a little less ideal because they’re effectively static images without the magic of keeping the header & index in-place as the user scrolls around the dataframe. Any clue how to do this with the native st.dataframe()? Or something that behaves similarly (i.e. can do the three things bulleted above). I’m open to hacks and other libraries you may know, but the ideal would be Streamlit-native (but beggars can’t be choosers).