some nice formatting to ensure there is only one installer

This commit is contained in:
Jun-te Kim 2025-04-14 15:56:42 +00:00
parent cc07706fc1
commit 94f7ca3ab6

View file

@ -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'
)