great-tables icon indicating copy to clipboard operation
great-tables copied to clipboard

Value based styling for pivoted tables?

Open igorcalabria opened this issue 7 months ago • 6 comments

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

igorcalabria avatar Jul 01 '24 12:07 igorcalabria