Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sebhoerl committed Feb 4, 2024
1 parent de173ea commit ef7247f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion data/census/filtered.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@ def execute(context):
initial_persons = len(df["person_id"].unique())
removed_persons = np.count_nonzero(df["household_id"].isin(remove_ids))

# Verify with requested codes
# Filter requested codes
df_codes = context.stage("data.spatial.codes")

requested_departements = df_codes["departement_id"].unique()
df = df[df["departement_id"].isin(requested_departements)]

excess_communes = set(df["commune_id"].unique()) - set(df_codes["commune_id"].unique())
if not excess_communes == {"undefined"}:
raise RuntimeError("Found additional communes: %s" % excess_communes)
Expand Down

0 comments on commit ef7247f

Please sign in to comment.