You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to create a line that runs across the top of the last row of my table (to separate the "Total" row from the rest of the table). This works great using .tab_style, but when I also specify rowname_col, the style is removed from the rowname_col column. I would expect that that the defined tab_style still works regardless of whether rowname_col is specified.
importpolarsasplfromgreat_tablesimportGT, md, html, style, locfromgreat_tables.dataimportislandsislands_mini= (
pl.from_pandas(islands).sort("size", descending=True)
.head(10)
)
(
GT(islands_mini,
rowname_col="name"# Comment out this line to show intended style.
)
.tab_header(
title="Large Landmasses of the World",
subtitle="The top ten largest are presented"
)
.tab_source_note(source_note="Source: The World Almanac and Book of Facts, 1975, page 406.")
.tab_source_note(
source_note=md("Reference: McNeil, D. R. (1977) *Interactive Data Analysis*. Wiley.")
)
.tab_stubhead(label="landmass")
.fmt_integer(columns="size")
.tab_style(
style=style.borders(sides=["top"], style="double", weight="4px"),
locations=loc.body(rows=[-1])
)
)
Thanks for raising -- this hits a tricky piece with how we've broken apart table structure. Basically, without rowname_col there is no row stub, just a table body. This means the line crosses the whole table.
With rowname_col specified, there is a row stub. So we need to also tell it to underline that row in the row stub. This should be supported once we complete #170, since it will allow you to use loc.stub() in addition to loc.body() for underlining.
I am trying to create a line that runs across the top of the last row of my table (to separate the "Total" row from the rest of the table). This works great using
.tab_style
, but when I also specifyrowname_col
, the style is removed from therowname_col
column. I would expect that that the defined tab_style still works regardless of whetherrowname_col
is specified.Reproducible example
(adapted from the docs)
With rowname_col
Without rowname_col
Development environment
The text was updated successfully, but these errors were encountered: