Skip to content

Commit 9c2057f

Browse files
committed
Fix bug in get_wealth_group_dataframe for WB - see HEA-573
Francophone BSS have `à` in row 4 in the WB worksheet in the summary columns (`synthèse | de | à`). And `a` is an alias for the B/O Wealth Group Category (from Aisé). So the previous code was matching that and thinking the data was for B/O instead of part of the WB summary.
1 parent 81b8ebd commit 9c2057f

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

pipelines/assets/baseline.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,17 +78,15 @@ def get_wealth_group_dataframe(
7878
# In the Summary columns in the Data, Data2, Data3 worksheets, the Wealth
7979
# Group Category is in Row 4 (District)rather than Row 3 (Wealth Group Category)
8080
# so do a second lookup to update the blank rows.
81-
# If this doesn't find any new values, then it's because in a WB worksheet
82-
# there are no extra Wealth Group Categories on Row 4
83-
try:
81+
# Note that in a WB worksheet there are no extra Wealth Group Categories on Row 4
82+
if worksheet_name != "WB":
8483
wealth_group_df = wealthgroupcategorylookup.do_lookup(
8584
wealth_group_df, "district", "wealth_group_category", update=True
8685
)
8786
# Remove the duplicate wealth_group_category_original column created by the second do_lookup(),
8887
# which otherwise causes problems when trying to merge dataframes, e.g. when building the wealth_group_df.
8988
wealth_group_df = wealth_group_df.loc[:, ~wealth_group_df.columns.duplicated()]
90-
except ValueError:
91-
pass
89+
9290
# Check if there are unrecognized wealth group categories and report
9391
wealth_group_missing_category_df = wealth_group_df[
9492
wealth_group_df["wealth_group_category"].isnull()

0 commit comments

Comments
 (0)