mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
exporting data for newhaven
This commit is contained in:
parent
681a449187
commit
6a83fe7d9b
2 changed files with 48 additions and 27 deletions
|
|
@ -204,12 +204,12 @@ class PropertyValuation:
|
|||
|
||||
@classmethod
|
||||
def estimate(cls, property_instance, target_epc):
|
||||
value = (
|
||||
current_value = (
|
||||
property_instance.valuation if property_instance.valuation else
|
||||
cls.UPRN_VALUE_LOOKUP.get(property_instance.uprn)
|
||||
)
|
||||
|
||||
if not value:
|
||||
if not current_value:
|
||||
return {
|
||||
"current_value": 0,
|
||||
"lower_bound_increased_value": 0,
|
||||
|
|
@ -239,12 +239,13 @@ class PropertyValuation:
|
|||
|
||||
max_increase = max(all_increases)
|
||||
min_increase = min(all_increases)
|
||||
|
||||
avg_increase = np.mean(all_increases)
|
||||
|
||||
return {
|
||||
"current_value": value,
|
||||
"lower_bound_increased_value": value * (1 + min_increase),
|
||||
"upper_bound_increased_value": value * (1 + max_increase),
|
||||
"average_increased_value": value * (1 + avg_increase),
|
||||
"average_increase": value * (1 + avg_increase) - value
|
||||
"current_value": current_value,
|
||||
"lower_bound_increased_value": current_value * (1 + min_increase),
|
||||
"upper_bound_increased_value": current_value * (1 + max_increase),
|
||||
"average_increased_value": current_value * (1 + avg_increase),
|
||||
"average_increase": current_value * (1 + avg_increase) - current_value
|
||||
}
|
||||
|
|
|
|||
|
|
@ -418,7 +418,7 @@ def slides():
|
|||
pd.set_option('display.max_colwidth', None)
|
||||
|
||||
|
||||
def app():
|
||||
def lewes_outputs():
|
||||
"""
|
||||
preparing of this data for the following 2 needs:
|
||||
1) dataset to share with Nextgen heating
|
||||
|
|
@ -525,13 +525,13 @@ def app():
|
|||
recommendations_df["type"] == "heating",
|
||||
np.where(
|
||||
recommendations_df["description"].str.contains("air source heat pump"),
|
||||
"air_source_heat_pump",
|
||||
"Air Source Heat Pump",
|
||||
np.where(
|
||||
recommendations_df["description"].str.contains("high heat retention"),
|
||||
"high_heat_retention_storage_heaters",
|
||||
"High Heat Retention Storage",
|
||||
np.where(
|
||||
recommendations_df["description"].str.contains("condensing boiler"),
|
||||
"boiler_upgrade",
|
||||
"Boiler Upgrade",
|
||||
recommendations_df["type"]
|
||||
)
|
||||
)
|
||||
|
|
@ -552,7 +552,6 @@ def app():
|
|||
'room_roof_insulation': 'Room Roof Insulation',
|
||||
'low_energy_lighting': 'Low Energy Lighting',
|
||||
'external_wall_insulation': 'External Wall Insulation',
|
||||
'heating': 'Heating',
|
||||
'solar_pv': 'Solar PV',
|
||||
'heating_control': 'Heating Control',
|
||||
'solid_floor_insulation': 'Solid Floor Insulation',
|
||||
|
|
@ -634,7 +633,7 @@ def app():
|
|||
|
||||
property_scenario_impact = pd.concat(property_scenario_impact)
|
||||
# property_scenario_impact = property_scenario_impact.drop(columns=["property_id", "Estimated Kwh Savings"])
|
||||
for v in rename_dict.values():
|
||||
for v in list(rename_dict.values()) + ["Air Source Heat Pump", "High Heat Retention Storage", "Boiler Upgrade"]:
|
||||
# Fill NaNs with False
|
||||
property_scenario_impact[v] = property_scenario_impact[v].fillna(False)
|
||||
|
||||
|
|
@ -731,45 +730,66 @@ def app():
|
|||
scenario_names, how="left", on="scenario_id"
|
||||
)
|
||||
|
||||
property_scenario_impact = property_scenario_impact.sort_values(
|
||||
["postcode", "uprn", "scenario_id"], ascending=True
|
||||
)
|
||||
|
||||
lewes_data = next_gen_dataset.merge(
|
||||
property_scenario_impact, how="left", on="uprn"
|
||||
)
|
||||
|
||||
lewes_data = lewes_data.sort_values(
|
||||
["postcode", "uprn", "scenario_id"], ascending=True
|
||||
)
|
||||
|
||||
# Rearrange, rename columns and drop what we don't need
|
||||
# TODO - remap the heating type
|
||||
lewes_data = lewes_data[
|
||||
[
|
||||
'uprn', 'address', 'postcode', 'property_type', 'built_form', 'estimated_heating_hotwater_kwh',
|
||||
'uprn', 'address', 'postcode', 'property_type', 'built_form',
|
||||
# 'estimated_heating_hotwater_kwh',
|
||||
'primary_fuel_type', 'gross_floor_area', 'floor_height', 'number_of_floors', 'ashp_suitable',
|
||||
'ashp_size_kw',
|
||||
'ashp_cost', 'solar_suitable', 'solar_size_kwp', 'solar_cost', 'estimated_heating_hotwater_kwh_scaled',
|
||||
'ashp_cost', 'solar_suitable', 'solar_size_kwp', 'solar_cost',
|
||||
'scenario',
|
||||
'estimated_heating_hotwater_kwh_scaled',
|
||||
'post_scenario_heating_hotwater_kwh_scaled',
|
||||
# 'property_id', - dropped
|
||||
'current_energy_demand_heating_hotwater', 'Estimated Heating Demand kWh Savings',
|
||||
'Estimated Lighting kWh Savings', 'Estimated Solar kWh Savings', 'estimated_cost',
|
||||
# 'current_energy_demand_heating_hotwater',
|
||||
'Estimated Heating Demand kWh Savings',
|
||||
'Estimated Lighting kWh Savings',
|
||||
'Estimated Solar kWh Savings',
|
||||
'estimated_cost',
|
||||
'post_scenario_heating_hotwater_kwh', 'Cavity Wall Insulation', 'Cylinder Thermostat',
|
||||
'Flat Roof Insulation',
|
||||
'Hot Water Tank Insulation', 'Loft Insulation', 'Mechanical Ventilation', 'Room Roof Insulation',
|
||||
# 'scenario_id', - dropped
|
||||
'Low Energy Lighting', 'Secondary Heating', 'Windows Glazing', 'External Wall Insulation',
|
||||
'Heating',
|
||||
'Heating Control',
|
||||
'Solar PV',
|
||||
'Air Source Heat Pump', 'Boiler Upgrade', 'High Heat Retention Storage',
|
||||
'Internal Wall Insulation',
|
||||
'Solid Floor Insulation',
|
||||
'Suspended Floor Insulation',
|
||||
'post_scenario_heating_hotwater_kwh_scaled',
|
||||
'scenario'
|
||||
]
|
||||
|
||||
]
|
||||
].rename(
|
||||
columns={
|
||||
"primary_fuel_type": "Primary Fuel Type",
|
||||
"gross_floor_area": "Gross Floor Area",
|
||||
"floor_height": "Floor Height",
|
||||
"number_of_floors": "Number of Floors",
|
||||
"ashp_suitable": "Is an ASHP Suitable?",
|
||||
"ashp_size_kw": "ASHP Size (kW)",
|
||||
"ashp_cost": "ASHP Cost",
|
||||
"solar_suitable": "Is Solar PV Suitable?",
|
||||
"solar_size_kwp": "Solar PV Size (kWp)",
|
||||
"solar_cost": "Solar PV Cost",
|
||||
# "estimated_heating_hotwater_kwh": "Estimated Heating & Hot Water kwh",
|
||||
"estimated_heating_hotwater_kwh_scaled": "Estimated Heating & Hot Water kwh",
|
||||
"post_scenario_heating_hotwater_kwh_scaled": "Post Scenario Heating & Hot Water kwh",
|
||||
"estimated_cost": "Estimated Cost of Scenario"
|
||||
}
|
||||
)
|
||||
|
||||
# We save this dataset, which will be shared with Lewes Council
|
||||
lewes_data.to_csv(
|
||||
"/Users/khalimconn-kowlessar/Documents/hestia/Customers/Newhaven/outputs/property data.csv", index=False
|
||||
"/Users/khalimconn-kowlessar/Documents/hestia/Customers/Newhaven/outputs/Lewes property data.csv", index=False
|
||||
)
|
||||
|
||||
df_pivot = property_scenario_impact.pivot_table(index='uprn', columns='scenario',
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue