From e85936ae97f61b2fc64a41cbf1fd2435927832d9 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Sun, 28 Jul 2024 15:36:48 +0100 Subject: [PATCH] apartment string match --- etl/customers/goldman/property_ownership.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/etl/customers/goldman/property_ownership.py b/etl/customers/goldman/property_ownership.py index 71c53a74..5d39f139 100644 --- a/etl/customers/goldman/property_ownership.py +++ b/etl/customers/goldman/property_ownership.py @@ -691,6 +691,7 @@ def app(): ) # We check if we have a flat match_flat_number = re.match("flat (\d+)", match["epc_address1"].lower()) + match_apartment_number = re.match("apartment (\d+)", match["epc_address1"].lower()) lr_filtered["saon_match3"] = False if match_flat_number is not None: # Get out the match @@ -699,6 +700,13 @@ def app(): lambda x: False if pd.isnull(x) else x == match_flat_number ) + if match_apartment_number is not None: + # Get out the match + match_apartment_number = "apartment " + match_apartment_number.group(1) + lr_filtered["saon_match3"] = lr_filtered["saon"].apply( + lambda x: False if pd.isnull(x) else x == match_apartment_number + ) + if all_paon_equal and all_saon_equal and all_street_equal: # Take the newest record lr_filtered = lr_filtered.sort_values("date_of_transfer", ascending=False)