Styling
Data in a Polars DataFrame
can be styled for presentation use the DataFrame.style
property. This returns a GT
object from Great Tables, which enables structuring, formatting, and styling for table display.
{{code_block('user-guide/misc/styling','dataframe',[])}}
Structure: add header title
{{code_block('user-guide/misc/styling','structure-header',[])}}
Structure: add row stub
{{code_block('user-guide/misc/styling','structure-stub',[])}}
Structure: add column spanner
{{code_block('user-guide/misc/styling','structure-spanner',[])}}
Format: limit decimal places
{{code_block('user-guide/misc/styling','format-number',[])}}
Style: highlight max row
{{code_block('user-guide/misc/styling','style-simple',[])}}
Style: bold species column
{{code_block('user-guide/misc/styling','style-bold-column',[])}}
Full example
{{code_block('user-guide/misc/styling','full-example',[])}}