From 588cf4a3c98c204d6397353be8c183dc6cae513f Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Wed, 14 Feb 2024 22:35:35 +0100 Subject: [PATCH] fix(code): Differentiate between national and census data --- 03-documentation/findings-per-policy-area.md | 2 ++ src/prep_data.py | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/03-documentation/findings-per-policy-area.md b/03-documentation/findings-per-policy-area.md index e38ea78..e19ce75 100644 --- a/03-documentation/findings-per-policy-area.md +++ b/03-documentation/findings-per-policy-area.md @@ -1,5 +1,7 @@ # Summary of study findings +written into 02-data/supplementary/findings-*.csv tables + ## Institutional ### Labour laws / regulatory systems diff --git a/src/prep_data.py b/src/prep_data.py index 9c4af44..21d9ec4 100644 --- a/src/prep_data.py +++ b/src/prep_data.py @@ -18,9 +18,9 @@ def calculate_validities( vd[repr_col] = vd[repr_col].fillna("") vd[method_col] = vd[method_col].fillna("") - # needs to check national before subnational, subnational before local - vd.loc[vd[repr_col].str.contains("national"), EXT_COL_NAME] = 5.0 - vd.loc[vd[repr_col].str.contains("regional"), EXT_COL_NAME] = 4.0 + # needs to check national before subnational and census, subnational before local + vd.loc[vd[repr_col].str.contains("|".join(["national", "regional"])), EXT_COL_NAME] = 4.0 + vd.loc[vd[repr_col].str.contains("census"), EXT_COL_NAME] = 5.0 vd.loc[vd[repr_col].str.contains("subnational"), EXT_COL_NAME] = 3.0 vd.loc[vd[repr_col].str.contains("local"), EXT_COL_NAME] = 2.0