From 78cfea5e675ba2e2c9805034b08641e6ed4e22ed Mon Sep 17 00:00:00 2001 From: Sujan Adhikari Date: Thu, 26 Sep 2024 17:52:15 +0545 Subject: [PATCH 1/2] fix: remove multiple duplicates in choice sheets --- osm_fieldwork/update_xlsform.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osm_fieldwork/update_xlsform.py b/osm_fieldwork/update_xlsform.py index 8aed029c..7ba9580d 100644 --- a/osm_fieldwork/update_xlsform.py +++ b/osm_fieldwork/update_xlsform.py @@ -36,7 +36,7 @@ def merge_dataframes(mandatory_df: pd.DataFrame, user_question_df: pd.DataFrame, # If processing the choices sheet, retain all duplicates if "list_name" in user_question_df.columns: - return pd.concat( + merged_df = pd.concat( [ mandatory_df, user_question_df, @@ -44,6 +44,7 @@ def merge_dataframes(mandatory_df: pd.DataFrame, user_question_df: pd.DataFrame, ], ignore_index=True, ) + return merged_df.drop_duplicates(subset=['list_name', NAME_COLUMN], ignore_index=True) # Else we are processing the survey sheet, continue From 176791b86a639188d3e3d1700f6e1d90c16e68bb Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 26 Sep 2024 12:13:51 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- osm_fieldwork/update_xlsform.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osm_fieldwork/update_xlsform.py b/osm_fieldwork/update_xlsform.py index 7ba9580d..72a8bdae 100644 --- a/osm_fieldwork/update_xlsform.py +++ b/osm_fieldwork/update_xlsform.py @@ -44,7 +44,7 @@ def merge_dataframes(mandatory_df: pd.DataFrame, user_question_df: pd.DataFrame, ], ignore_index=True, ) - return merged_df.drop_duplicates(subset=['list_name', NAME_COLUMN], ignore_index=True) + return merged_df.drop_duplicates(subset=["list_name", NAME_COLUMN], ignore_index=True) # Else we are processing the survey sheet, continue