File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -88,7 +88,17 @@ def get_wealth_group_dataframe(
8888 wealth_group_df = wealth_group_df .loc [:, ~ wealth_group_df .columns .duplicated ()]
8989 except ValueError :
9090 pass
91-
91+ # Check if there are unrecognized wealth group category at this point and report
92+ wealth_group_missing_category_df = wealth_group_df [
93+ wealth_group_df ["wealth_group_category" ].isnull ()
94+ & wealth_group_df ["wealth_group_category_original" ].notnull ()
95+ ]
96+ if not wealth_group_missing_category_df .empty :
97+ unique_values = set (wealth_group_missing_category_df ["wealth_group_category_original" ].unique ())
98+ raise ValueError (
99+ "%s has unrecognized wealth group category in %s:\n %s"
100+ % (partition_key , worksheet_name , "\n " .join (unique_values )),
101+ )
92102 # Lookup the Community instances
93103 community_lookup = CommunityLookup ()
94104 wealth_group_df ["livelihood_zone_baseline" ] = livelihood_zone_baseline .id # required parent for lookup
You can’t perform that action at this time.
0 commit comments