Great Tables

Just wanted to show that great tables work with Panel out of the box.


import polars as pl

from great_tables import GT, html
from great_tables.data import sza

sza_pivot = (
    pl.from_pandas(sza)
    .filter((pl.col("latitude") == "20") & (pl.col("tst") <= "1200"))
    .select(pl.col("*").exclude("latitude"))
    .drop_nulls()
    .pivot(values="sza", index="month", columns="tst", sort_columns=True)
)

table = (
    GT(sza_pivot, rowname_col="month")
    .data_color(
        domain=[90, 0],
        palette=["rebeccapurple", "white", "orange"],
        na_color="white",
    )
    .tab_header(
        title="Solar Zenith Angles from 05:30 to 12:00",
        subtitle=html("Average monthly values at latitude of 20&deg;N."),
    )
)

import panel as pn

ACCENT = "#70409f"
pn.extension()
pn.template.FastListTemplate(
    site="Panel", title="Great Tables", main=[table], main_layout=None, accent=ACCENT
).servable()
5 Likes