From 548b20d4e854a21d1f3c28115e7b611164be53af Mon Sep 17 00:00:00 2001 From: Fabrizio Miano Date: Fri, 26 Feb 2021 00:25:32 +0100 Subject: [PATCH] =?UTF-8?q?Revert=20"v4.5.0:=20=F0=9F=A4=93=20Use=20the=20?= =?UTF-8?q?total=20of=20second=20doses=20(#13)"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/data/etl.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/app/data/etl.py b/app/data/etl.py index 82a6573..1872eb8 100644 --- a/app/data/etl.py +++ b/app/data/etl.py @@ -14,7 +14,7 @@ REGIONS, PROVINCES, DATE_KEY, CHART_DATE_FMT, STATE_KEY, NEW_POSITIVE_MA_KEY, VAX_AGE_KEY, M_SEX_KEY, F_SEX_KEY, VAX_DATE_KEY, VAX_DATE_FMT, VAX_AREA_KEY, VAX_TYPE_KEY, ITALY_POPULATION, OD_TO_PC_MAP, - POP_KEY, VAX_TOT_ADMINS_KEY + POP_KEY ) COLUMNS_TO_DROP = [STATE_KEY] @@ -439,14 +439,14 @@ def build_provincial_series(df): def augment_vax_df(df): """Clean 'fascia_anagrafica key, add 'total' and 'id' to df""" df[VAX_AGE_KEY] = df[VAX_AGE_KEY].apply(lambda x: x.strip()) - df[VAX_TOT_ADMINS_KEY] = df[M_SEX_KEY] + df[F_SEX_KEY] + df['totale'] = df[M_SEX_KEY] + df[F_SEX_KEY] df['_id'] = ( df[VAX_DATE_KEY].apply( lambda x: x.strftime(VAX_DATE_FMT)) + df[VAX_AREA_KEY] + df[VAX_AGE_KEY] + df[VAX_TYPE_KEY] - ).apply(lambda x: hash(x)) + ) return df @@ -464,15 +464,14 @@ def augment_summary_vax_df(df): for col in reg_df: if isinstance(reg_df[col].values[-1], str): reg_df[col].ffill(inplace=True) - else: - reg_df.fillna(0, inplace=True) + else: + reg_df.fillna(0, inplace=True) out_df = out_df.append(reg_df) out_df.reset_index(inplace=True) out_df['_id'] = ( out_df[VAX_DATE_KEY].apply( lambda x: x.strftime(VAX_DATE_FMT)) + out_df[VAX_AREA_KEY] ) - out_df['_id'] = out_df['_id'].apply(lambda x: hash(x)) out_df[POP_KEY] = out_df[VAX_AREA_KEY].apply( lambda x: ITALY_POPULATION[OD_TO_PC_MAP[x]]) return out_df