Skip to content

Commit edcf81f

Browse files
committed
remove aggregate data
1 parent 4d644d9 commit edcf81f

1 file changed

Lines changed: 17 additions & 3 deletions

File tree

index.qmd

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,22 @@ import re
105105

106106
```{python}
107107
labour = read_labourcan(LABOUR_DATA_FILE)
108-
labour_processed = calculate_centered_rank(labour)
108+
109+
# Remove Aggregated Rows
110+
labour_filtered = labour.filter(
111+
~pl.col("Industry").is_in(
112+
[
113+
"Total employed, all industries",
114+
"Goods-producing sector",
115+
"Services-producing sector",
116+
]
117+
)
118+
)
119+
120+
# Calculate ranking based on monthly % change
121+
labour_processed = calculate_centered_rank(labour_filtered)
122+
123+
# Bin % difference
109124
labour_processed_cutted = cut_pdiff(labour_processed, DEFAULT_CUTS)
110125
plot_data = labour_processed_cutted.filter(
111126
pl.col("YEAR") >= FILTER_YEAR[0], pl.col("YEAR") <= FILTER_YEAR[1]
@@ -143,7 +158,6 @@ LEGEND_LABELS = [
143158
]
144159
```
145160

146-
147161
# Sector Shifts: Where Canada's Jobs Are Moving
148162

149163
Track the number of industries gaining or losing jobs each month. Boxes are shaded based on percentage change from previous month in each industry's employment levels.
@@ -198,7 +212,7 @@ plot
198212
```{python}
199213
# | output: asis
200214
ALL_INDUSTRIES = (
201-
labour_processed_cutted.select("Industry").unique().to_series().to_list()
215+
labour_filtered.select("Industry").unique(maintain_order=True).to_series().to_list()
202216
)
203217
204218
for INDUSTRY in ALL_INDUSTRIES:

0 commit comments

Comments
 (0)