ebm.holiday_home_energy module
- class HolidayHomeEnergy(population: Series, holiday_homes_by_category: DataFrame, electricity_usage_stats: Series, fuelwood_usage_stats: Series, fossil_fuel_usage_stats: Series)[source]
Bases:
object- __init__(population: Series, holiday_homes_by_category: DataFrame, electricity_usage_stats: Series, fuelwood_usage_stats: Series, fossil_fuel_usage_stats: Series)[source]
- calculate_energy_usage() Iterable[Series][source]
Calculate projected energy usage for holiday homes.
This method projects future energy usage for electricity, fuelwood, and fossil fuels based on historical data and combines these projections with existing statistics.
Yields
- Iterable[pd.Series]
A series of projected energy usage values for electricity, fuelwood, and fossil fuels, with NaN values filled from the existing statistics.
- static new_instance(database_manager: DatabaseManager = None) HolidayHomeEnergy[source]
- project_electricity_usage(electricity_usage_stats: Series, holiday_homes_by_category: DataFrame, population: Series) Series[source]
Calculate the projected electricity usage for holiday homes.
This function projects the future electricity usage for holiday homes based on historical electricity usage statistics, the number of holiday homes by category, and population data.
Population is used to work out what years are needed in the projection.
Parameters
- electricity_usage_statspd.Series
A pandas Series containing historical electricity usage statistics.
- holiday_homes_by_categorypd.DataFrame
A pandas DataFrame containing the number of holiday homes by year. Each column is considered as a category.
- populationpd.Series
A pandas Series containing population data.
Returns
- pd.Series
A pandas Series with the projected electricity usage in gigawatt-hours (GWh) for future years.
Raises
- ValueError
If the input Series do not meet the expected criteria.
- project_fuelwood_usage(fuelwood_usage_stats: Series, holiday_homes_by_category: DataFrame, population: Series) Series[source]
- project_fossil_fuel_usage(fossil_fuel_usage_stats: Series, holiday_homes_by_category: DataFrame, population: Series) Series[source]
- population_over_holiday_homes(population: Series, holiday_homes: Series) Series[source]
Average number of holiday homes by population.
Parameters
population : pd.Series holiday_homes : pd.Series
Returns
pd.Series
- projected_holiday_homes(population: Series, holiday_homes: Series) Series[source]
Projects future number of holiday homes based on the population and historical average number of holiday homes
Parameters
- populationpd.Series
population in every year of the projection
- holiday_homespd.Series
historical number of holiday homes
Returns
- pd.Series
population over average number of holiday homes
- energy_usage_by_holiday_homes(energy_usage: Series, holiday_homes: Series) Series[source]
(08) 14 Elektrisitet pr fritidsbolig staitsikk (kWh) in Energibruk fritidsboliger.xlsx (10) 16 Ved pr fritidsbolig statistikk (kWh) 2019 - 2023
Parameters
- energy_usagepd.Series
Electricity usage by year from SSB https://www.ssb.no/statbank/sq/10103348 2001 - 2023
- holiday_homespd.Series
Total number of holiday homes of any category from SSB https://www.ssb.no/statbank/sq/10103336
Returns
- projected_fuelwood_usage_holiday_homes(historical_fuelwood_usage: Series) Series[source]
- Projects future fuelwood usage for holiday homes based on historical data. The projection
is calculated as the mean of the last 5 years of historical_fuelwood_usage.
Parameters
historical_fuelwood_usage : pd.Series
Returns
- pd.Series
- A pandas Series with with NaN values in fuelwood usage replaced by projected use. Years present
in historical_fuelwood_usage is returned as NaN
- projected_electricity_usage_holiday_homes(electricity_usage: Series)[source]
Project future electricity usage for holiday homes based on historical data.
This function projects future electricity usage by creating three ranges of projections and padding the series with NaN values and the last projection value as needed.
15 (09) Elektrisitet pr fritidsbolig framskrevet (kWh) in Energibruk fritidsboliger.xlsx
Parameters
- electricity_usagepd.Series
A pandas Series containing historical electricity usage data. The index should include the year 2019, and the Series should contain at least 40 years of data with some NaN values for projection.
Returns
- pd.Series
- A pandas Series with with NaN values in electricity usage replaced by projected energy use. Years with
values in energy_usage has a projected usage of NaN
Raises
- ValueError
If the year 2019 is not in the index of the provided Series. If there are no NaN values in the provided Series. If the length of the Series is less than or equal to 40.
- calculate_energy_use(database_manager: DatabaseManager) DataFrame[source]
Calculates holiday home energy use by from HolidayHomeEnergy.calculate_energy_usage()
Parameters
database_manager : DatabaseManager
Returns
pd.DataFrame