From 9f9799cfa8a65a2714a91bd47a68dc57538758d0 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Fri, 3 May 2024 13:35:49 +0100 Subject: [PATCH] finishing property ownership| --- etl/customers/goldman/property_ownership.py | 27 +++------------------ 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/etl/customers/goldman/property_ownership.py b/etl/customers/goldman/property_ownership.py index abc2645d..89e7c976 100644 --- a/etl/customers/goldman/property_ownership.py +++ b/etl/customers/goldman/property_ownership.py @@ -255,13 +255,6 @@ def app(): properties["TENURE"].isin(["rental (private)", "Rented (private)", "owner-occupied", "Owner-occupied"]) ] - ignore_title_numbers = [ - "WM922695", # Land at the back of 17 Plumstead Road, Birmingham (B44 0EA): relates to WM154788 - "WM426374", # land on the south side of 15 Carlyle Road, Edgbaston, Birmingham (B16 9BH): relates to WM537591 - "WM44948", - ] - company_ownership = company_ownership[~company_ownership["Title Number"].isin(ignore_title_numbers)] - # Remove entries where the address begins with the term "land adjoining", or other records that don't reference the # the property itself starting_terms = [ @@ -271,17 +264,9 @@ def app(): ] for starting_term in starting_terms: company_ownership = company_ownership[ - ~company_ownership["Property Address"].str.lower().str.startswith() + ~company_ownership["Property Address"].str.lower().str.startswith(starting_term) ] - biggest_ownership = ( - company_ownership - .groupby(["Company Registration No. (1)", "Proprietor Name (1)"])["Title Number"] - .count() - .reset_index(name="n_owned_properties") - ) - biggest_ownership = biggest_ownership.sort_values("n_owned_properties", ascending=False) - freehold_matching_lookup = [] # 634 leasehold_matching_lookup = [] # 86 shared_leasehold_match = [] @@ -400,13 +385,9 @@ def app(): pd.concat([freehold_matching_lookup, leasehold_matching_lookup]), company_ownership, properties ) + df = pd.concat([freehold_matching_lookup, leasehold_matching_lookup]) + investment_20m = combined_aggregate[combined_aggregate["cumulative_value"] <= 20_500_000] investment_50m = combined_aggregate[combined_aggregate["cumulative_value"] <= 51_000_000] - z = company_ownership[ - (company_ownership["Company Registration No. (1)"] == freehold_aggregate["Company Registration No. (1)"].values[ - 0]) & - (company_ownership["Title Number"].isin(freehold_matching_lookup["Title Number"].values)) - ] - - df = freehold_matching_lookup.merge(company_ownership, how="left", on="Title Number") + properties["WALLS_DESCRIPTION"].value_counts(normalize=True)