great-tables
great-tables copied to clipboard
Value based styling for pivoted tables?
Question
What would you like to know?
Hi, not sure if I've missed something but is there an easy way to apply conditional styles (https://posit-dev.github.io/great-tables/get-started/basic-styling.html) to pivoted tables (ie. Dates as columns)?
I know it's possible to pass a polars column selector in the location body, but I haven´t found a proper way to select rows per column automatically.
Something like this
tab_style(
style=style.text(color="white"),
locations=loc.body(
columns=cs.numeric(),
rows=pl.col("each-column-from-the-selector").eq(0)
)
)
The alternative is applying styles on individual columns but that's a bit cumbersome when columns are dynamic