From 94f7ca3ab657b063a3f4f91789912e3a1b653013 Mon Sep 17 00:00:00 2001 From: Jun-te Kim Date: Mon, 14 Apr 2025 15:56:42 +0000 Subject: [PATCH] some nice formatting to ensure there is only one installer --- etl/surveyPrice/surveyPrice.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/etl/surveyPrice/surveyPrice.py b/etl/surveyPrice/surveyPrice.py index dd8c45e..6c46b07 100644 --- a/etl/surveyPrice/surveyPrice.py +++ b/etl/surveyPrice/surveyPrice.py @@ -152,6 +152,7 @@ class SurveyPrice(): if self.all_hubspot_submissions is None: raise RuntimeError("No information found from Hubspot") + # Standardise address self.all_survey_info_from_sharepoint['clean_address'] = self.all_survey_info_from_sharepoint['SHAREPOINT ADDRESS'].apply( lambda x: x.lower().replace(',', '').strip() ) @@ -160,11 +161,20 @@ class SurveyPrice(): lambda x: x.lower().replace(',', '').strip() ) + # re-name to installer + self.all_survey_info_from_sharepoint = self.all_survey_info_from_sharepoint.rename( + columns={'SHAREPOINT INSTALLER': 'INSTALLER'} + ) + + self.all_hubspot_submissions = self.all_hubspot_submissions.rename( + columns={'HUBSPOT_INSTALLER': 'INSTALLER'} + ) + merged_df = pd.merge( self.all_survey_info_from_sharepoint, self.all_hubspot_submissions, - left_on=['clean_address', 'SHAREPOINT INSTALLER'], - right_on=['clean_address', 'HUBSPOT_INSTALLER'], + left_on=['clean_address', 'INSTALLER'], + right_on=['clean_address', 'INSTALLER'], how='inner' )