from great_tables import GT
from great_tables.data import towny
import gt_extras as gte
mini_towny = towny.head(10)
gt = GT(mini_towny).cols_hide(None).cols_unhide("name")
columns = [
"pop_change_1996_2001_pct",
"pop_change_2001_2006_pct",
"pop_change_2006_2011_pct",
]
for col in columns:
gt = (
gt
.cols_align(columns=col, align="center")
.cols_unhide(col)
.cols_label({col: col[11:20]})
.pipe(
gte.gt_fa_rank_change,
column=col,
neutral_range=[-0.01, 0.01],
)
)
gt| name | 1996_2001 | 2001_2006 | 2006_2011 |
|---|---|---|---|
| Addington Highlands | -0.0111
|
0.0458
|
0.002
|
| Adelaide Metcalfe | 0.0067
|
-0.0044
|
-0.0341
|
| Adjala-Tosorontio | 0.0773
|
0.0608
|
-0.0086
|
| Admaston/Bromley | -0.0046
|
-0.0382
|
0.0471
|
| Ajax | 0.1447
|
0.2226
|
0.2155
|
| Alberton | -0.0691
|
0.0021
|
-0.0981
|
| Alfred and Plantagenet | 0.0334
|
0.0071
|
0.0626
|
| Algonquin Highlands | 0.083
|
0.0816
|
0.1063
|
| Alnwick/Haldimand | 0.0575
|
0.1008
|
0.0283
|
| Amaranth | 0.0928
|
0.0199
|
0.0307
|