mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
29 lines
651 B
Python
29 lines
651 B
Python
import pandas as pd
|
|
from tqdm import tqdm
|
|
from backend.address2UPRN.main import get_uprn
|
|
|
|
# Enable tqdm for pandas
|
|
tqdm.pandas()
|
|
|
|
file_name = "brentwood.xlsx"
|
|
|
|
df = pd.read_excel(file_name)
|
|
|
|
|
|
def extract_uprn(row):
|
|
user_input = "Address"
|
|
postcode = "Postcode"
|
|
result = get_uprn(row[user_input], row[postcode], return_address=True)
|
|
|
|
if result is None:
|
|
return pd.Series([None, None])
|
|
|
|
uprn, found_address = result
|
|
return pd.Series([uprn, found_address])
|
|
|
|
|
|
df[["juntes uprn", "junte found address", "junte found epc"]] = df.progress_apply(
|
|
extract_uprn, axis=1
|
|
)
|
|
|
|
df.to_excel(f"{file_name}_outputs.xlsx", index=False)
|