ebm.validators module

Pandera validators for ebm input files.

check_building_category(value: Series) Series[source]

Makes sure that the series value contains values that are corresponding to a BuildingCategory

Parameters

value: pd.Series

A series of str that will be checked against BuildingCategory

Returns

pd.Series of bool values

check_default_building_category(value: Series) Series[source]

Makes sure that the series value contains values that are corresponding to a BuildingCategory or default

Parameters

value: pd.Series

A series of str that will be checked against BuildingCategory and ‘default’

Returns

pd.Series of bool values

check_default_building_category_with_group(value: Series) Series[source]

Makes sure that the series value contains values that are corresponding to a BuildingCategory, BuildingCategory group (RESIDENTIAL or NON_RESIDENTIAL) or ‘default’

Parameters

value: pd.Series

A series of str that will be checked against BuildingCategory, RESIDENTIAL, NON_RESIDENTIAL and ‘default’

Returns

pd.Series of bool values

check_building_condition(value: Series) Series[source]

Makes sure that the series value contains values that are corresponding to a BuildingCondition

Parameters

value: pd.Series

A series of str that will be checked against BuildingCondition

Returns

pd.Series of bool values

check_existing_building_conditions(value: Series) Series[source]

Makes sure that the series contains values that are corresponding to ‘existing’ building conditions.

Existing building conditions are all members (conditions) of BuildingCondition, except of DEMOLITION.

Parameters

value: pd.Series

A series of str that will be checked against ‘existing’ BuildingCondition members

Returns

pd.Series of bool values

check_all_existing_building_conditions_present(df: DataFrame)[source]

Ensures that all ‘existing’ building conditions are present in the ‘building_conditions’ column for each unique combination of ‘building_category’, ‘building_code’, and ‘purpose’.

Existing building conditions are all members (conditions) of BuildingCondition, except of DEMOLITION.

Parameters

df: pd.Dataframe

check_energy_purpose(value: Series) Series[source]

Makes sure that the value contains one of the valid purpose values: ‘Cooling’, ‘Electrical equipment’, ‘Fans and pumps’, ‘HeatingDHW’, ‘HeatingRV’, or ‘Lighting’

Parameters:

value – Input value to check against the valid purpose values

Returns:

Series of bool values indicating if each value matches a valid purpose

Return type:

pd.Series

check_default_energy_purpose(value: Series) Series[source]

Makes sure that the value contains one of the default or purpose values: ‘Cooling’, ‘Electrical equipment’, ‘Fans and pumps’, ‘HeatingDHW’, ‘HeatingRV’, or ‘Lighting’

Parameters:

value – Input value to check against the valid purpose values

Returns:

Series of bool values indicating if each value matches a valid purpose

Return type:

pd.Series

check_building_code(value: str) bool[source]

A crude check to determine if value is a ‘building_code’

Parameters:

value (str) – A string to check if it’s a building_code

Returns:

True when the function thinks that value might be a building_code

Return type:

bool

check_default_building_code(value: str) bool[source]

A crude check to determine if value is a ‘building_code’ or default

Parameters:

value (str) – A string to check if it’s a TEK or default

Returns:

True when the function thinks that value might be a TEK

Return type:

bool

check_overlapping_building_code_periods(df: DataFrame) Series[source]
check_building_category_share(values: DataFrame) Series[source]

Makes sure that the sum of values in values.new_house_share + values.new_apartment_block_share is 1.0

Parameters:

values (pd.DataFrame) – A dataframe with new_house_share and new_apartment_block_share

Returns:

A series of bool with the truth value of new_house_share + new_apartment_block_share equals 1.0

Return type:

pd.Series

create_residential_area_checks()[source]
Creates a list of checks used for house and apartment_block categories.
  • Checks that the first two rows are not empty

  • Checks that the next (3) rows are empty

  • Checks that non-empty rows are not negative

Returns

List[pa.Check]

check_heating_systems(value: Series) Series[source]

Makes sure that the series contains values that corresponds to a HeatingSystems

Parameters

value: pd.Series

A series of str that will be checked against HeatingSystems

Returns

pd.Series of bool values

check_sum_of_heating_system_shares_equal_1(df: DataFrame)[source]
make_building_purpose(years: YearRange | None = None) DataFrame[source]

Returns a dataframe of all combinations building_categories, building_codes, original_condition, purposes and optionally years.

Parameters

years : YearRange, optional

Returns

pd.DataFrame

behaviour_factor_parser(df: DataFrame) DataFrame[source]
calculate_yearly_reduction(df)[source]
heating_system_forecast = <Schema DataFrameSchema(columns={'building_category': <Schema Column(name=building_category, type=DataType(str))>, 'building_code': <Schema Column(name=building_code, type=DataType(str))>, 'heating_systems': <Schema Column(name=heating_systems, type=DataType(str))>, 'new_heating_systems': <Schema Column(name=new_heating_systems, type=DataType(str))>}, checks=[], parsers=[], index=None, dtype=None, coerce=False, strict=False, name=None, ordered=False, unique=['building_category', 'building_code', 'heating_systems', 'new_heating_systems'], report_duplicates=all, unique_column_names=False, add_missing_columns=False, title=None, description=None, metadata=None, drop_invalid_rows=False)>

how to check columns that are heating systems (but not in enum) and ‘energivare’. Columns: ‘Grunnlast’: pa.Column(str), ‘Spisslast’: pa.Column(str), ‘Ekstralast’: pa.Column(str), ‘base_load_energy_product’: pa.Column(str), ‘peak_load_energy_product’: pa.Column(str), ‘tertiary_load_energy_product’: pa.Column(str),

Type:

TODO