Amateur space cadet here first and perhaps last question. I have spent a lot of time developing a styles dictionary for static (pdf) output from tables.
# itk teal style for data frame doesn't print the borders properly in vscode but does in jupyter
styles = [dict(selector="caption",
props=[("text-align", "left"),
("font-size", "150%"),
("color", 'white'),
("background-color", "teal")]),
dict(selector = "",props =[("color","grey"),("background-color",'white'),('border-bottom', '1px dotted grey')]),
dict(selector = "th",props =[("background-color",'white'),('border-bottom', '1px dotted grey')]),
dict(selector = "tr",props =[("background-color",'white'),('border-bottom', '1px dotted grey'),("color","black")]),
dict(selector = ".blank",props =[("background-color",'#00DCDC')]),
dict(selector = "th.col_heading",props =[("color",'black'),('font-size','110%'),("background-color",'#00DCDC')]),
dict( selector = "tr:last-child", props =[("color","black"),('border-bottom', '5px black')])]
When I try to output a table using Panel the column headings are compressed. The code I run is:
# annual VRE volumes and compare with PCP
vre_bits = ["nem_solar","nem_rooftop","nem_wind","nem_vre"]
nem_renewables = vre_data[vre_bits].copy()
nem_renewables["hydro"] = nemwide.hydro
nem_renewables["renewable_tot"] = nem_renewables.nem_vre + nem_renewables.hydro
df = nem_renewables.groupby(nem_renewables.index.year).mean()*8.76/1000
df["tot_demand"] = nemwide.total_vol.groupby(nemwide.index.year).mean()*8.76/1000
df["renewable_share %"] = df.renewable_tot / df.tot_demand*100
f = pn.Column(df.style .format ('{:,.0f}').set_caption("Renewable energy TWh").set_table_styles(styles))
f
Ah I don’t want to have to rewrite everything using html (which I don’t know). Just trying to understand the best way to use my existing styles in Panels or do I have to start again?