From 3387b117dcea84b131d1a781dafa60b367bf5757 Mon Sep 17 00:00:00 2001 From: wagnerlmichael <93889413+wagnerlmichael@users.noreply.github.com> Date: Tue, 3 Oct 2023 10:29:35 -0500 Subject: [PATCH] 26 fix flagging script mismatch between s3 and local (#32) Change S3 flagging script pandas code --- .../{flagging_324938.py => flagging_4472bc.py} | 6 +++--- glue/sales_val_flagging.py | 2 +- manual_flagging/src/flagging_rolling.py | 1 - 3 files changed, 4 insertions(+), 5 deletions(-) rename glue/flagging_script_glue/{flagging_324938.py => flagging_4472bc.py} (99%) diff --git a/glue/flagging_script_glue/flagging_324938.py b/glue/flagging_script_glue/flagging_4472bc.py similarity index 99% rename from glue/flagging_script_glue/flagging_324938.py rename to glue/flagging_script_glue/flagging_4472bc.py index 27bf9b3a..7dfe082a 100644 --- a/glue/flagging_script_glue/flagging_324938.py +++ b/glue/flagging_script_glue/flagging_4472bc.py @@ -546,9 +546,9 @@ def get_sale_counts(dups: pd.DataFrame) -> pd.DataFrame: df (pd.DataFrame): pandsa dataframe4 """ v_counts = ( - dups.pin.value_counts().reset_index() - # .rename(columns={"count": "sv_sale_dup_counts"}) - .rename(columns={"index": "pin", "pin": "sv_sale_dup_counts"}) + dups.pin.value_counts() + .reset_index() + .rename(columns={"count": "sv_sale_dup_counts"}) ) dups = pd.merge(dups, v_counts) diff --git a/glue/sales_val_flagging.py b/glue/sales_val_flagging.py index 3a345398..459eea61 100644 --- a/glue/sales_val_flagging.py +++ b/glue/sales_val_flagging.py @@ -747,7 +747,7 @@ def write_to_table(df, table_name, s3_warehouse_bucket_path, run_id): df_to_write=rows_to_append, df_ingest=df_ingest_full, iso_forest_cols=iso_forest_list, - res_stat_groups=inputs["stat_groups"], + res_stat_groups=stat_groups_list, condo_stat_groups=condo_stat_groups, dev_bounds=dev_bounds_list, ptax_sd=ptax_sd_list, diff --git a/manual_flagging/src/flagging_rolling.py b/manual_flagging/src/flagging_rolling.py index e826c5fd..7dfe082a 100644 --- a/manual_flagging/src/flagging_rolling.py +++ b/manual_flagging/src/flagging_rolling.py @@ -549,7 +549,6 @@ def get_sale_counts(dups: pd.DataFrame) -> pd.DataFrame: dups.pin.value_counts() .reset_index() .rename(columns={"count": "sv_sale_dup_counts"}) - # .rename(columns={"index": "pin", "pin": "sv_sale_dup_counts"}) ) dups = pd.merge(dups, v_counts)