From f706500e118c13668479bfa8731c7f69f0891490 Mon Sep 17 00:00:00 2001 From: lucasrodes Date: Mon, 13 May 2024 14:26:26 +0200 Subject: [PATCH] add data former members of czechoslovakia and yugoslavia --- .../lexical_index.countries_impute.yml | 40 +++++++++++++++++++ .../2024-03-07/lexical_index.meta.yml | 4 ++ .../democracy/2024-03-07/lexical_index.py | 7 ++-- 3 files changed, 48 insertions(+), 3 deletions(-) diff --git a/etl/steps/data/garden/democracy/2024-03-07/lexical_index.countries_impute.yml b/etl/steps/data/garden/democracy/2024-03-07/lexical_index.countries_impute.yml index 202c09cb0f8..077c5a51ac9 100644 --- a/etl/steps/data/garden/democracy/2024-03-07/lexical_index.countries_impute.yml +++ b/etl/steps/data/garden/democracy/2024-03-07/lexical_index.countries_impute.yml @@ -67,3 +67,43 @@ country_impute: Russia year_min: 1813 year_max: 1921 + +# Czechoslovakia +- country: + - Czechia + - Slovakia + country_impute: Czechoslovakia + year_min: 1918 + year_max: 1992 + +# Yugoslavia +- country: + - Croatia + - Bosnia and Herzegovina + - Slovenia + - North Macedonia + country_impute: Yugoslavia + year_min: 1918 + year_max: 1989 +- country: + - Serbia + - Montenegro + - Kosovo + country_impute: Yugoslavia + year_min: 1918 + year_max: 1991 + +# Serbia and Montenegro +- country: + - Serbia + - Montenegro + - Kosovo + country_impute: Serbia and Montenegro + year_min: 1992 + year_max: 2005 + +# Kosovo +- country: Kosovo + country_impute: Serbia + year_min: 2006 + year_max: 2007 diff --git a/etl/steps/data/garden/democracy/2024-03-07/lexical_index.meta.yml b/etl/steps/data/garden/democracy/2024-03-07/lexical_index.meta.yml index a9a2325cefc..f7e68dde8fb 100644 --- a/etl/steps/data/garden/democracy/2024-03-07/lexical_index.meta.yml +++ b/etl/steps/data/garden/democracy/2024-03-07/lexical_index.meta.yml @@ -16,6 +16,10 @@ tables: common: description_processing: |- Data for former USSR member states has been obtained by imputing the values of the USSR. This includes: Russia, Ukraine, Belarus, Latvia, Lithuania, Estonia, Armenia, Azerbaijan, Georgia, Kazakhstan, Kyrgyzstan, Tajikistan, Turkmenistan, Uzbekistan, and Moldova. + + Data for former Czechoslovakia member states has been obtained by imputing the values of Czechoslovakia. This includes: Czech Republic and Slovakia. + + Data for former Yugoslavia member states has been obtained by imputing the values of Yugoslavia. This includes: Slovenia, Croatia, Bosnia and Herzegovina, Serbia, Montenegro, Kosovo, and North Macedonia. variables: exelec_lied: title: Elections for chief executive diff --git a/etl/steps/data/garden/democracy/2024-03-07/lexical_index.py b/etl/steps/data/garden/democracy/2024-03-07/lexical_index.py index 2f402098ab7..fddf58c2378 100644 --- a/etl/steps/data/garden/democracy/2024-03-07/lexical_index.py +++ b/etl/steps/data/garden/democracy/2024-03-07/lexical_index.py @@ -123,14 +123,15 @@ def run(dest_dir: str) -> None: ) == {"Germany"}, "Other versions of Germany!" # Impute values - tb = add_imputes(tb=tb, path=PATH_IMPUTE, col_flag_imputed="values_imputed") + col_flag_imputed = "values_imputed" + tb = add_imputes(tb=tb, path=PATH_IMPUTE, col_flag_imputed=col_flag_imputed) # Get region data - tb_regions = tb.loc[~tb["values_imputed"]].drop(columns=["values_imputed"]).copy() + tb_regions = tb.loc[~tb[col_flag_imputed]].drop(columns=[col_flag_imputed]).copy() tb_regions = get_region_aggregates(tb_regions, ds_regions, ds_population) # Drop is imputed flag - tb = tb.drop(columns=["values_imputed"]) + tb = tb.drop(columns=[col_flag_imputed]) # Format tb = tb.format(["country", "year"])