finishing property ownership|

This commit is contained in:
Khalim Conn-Kowlessar 2024-05-03 13:35:49 +01:00
parent 5cb35e1d9e
commit 9f9799cfa8

View file

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