ebm.model.building_category module
- class MyEnumType(cls, bases, classdict, *, boundary=None, _simple=False, **kwds)[source]
Bases:
EnumType
- class BuildingCategory(value)[source]
Bases:
StrEnum- HOUSE = 'house'
- APARTMENT_BLOCK = 'apartment_block'
- KINDERGARTEN = 'kindergarten'
- SCHOOL = 'school'
- UNIVERSITY = 'university'
- OFFICE = 'office'
- RETAIL = 'retail'
- HOTEL = 'hotel'
- HOSPITAL = 'hospital'
- NURSING_HOME = 'nursing_home'
- CULTURE = 'culture'
- SPORTS = 'sports'
- STORAGE = 'storage_repairs'
- static from_string(category_name: str) BuildingCategory[source]
Create an enum object from category name :param category_name: :type category_name: str
- Returns:
building_category (BuildingCategory (Enum))
- Raises:
ValueError – category_name not found in BuildingCategory
- from_norsk(norsk: str) BuildingCategory[source]
- expand_building_category(row: Series) DataFrame[source]
Expand a row of data based on the building category into multiple rows, each representing a specific sub-category of either residential or non-residential buildings.
Parameters
- rowpd.Series
A pandas Series containing the data for a single row, including a ‘building_category’ field.
Returns
- pd.DataFrame
A DataFrame with expanded rows for each sub-category of the building category.
- expand_building_categories(df: DataFrame, unique_columns: List[str] = None)[source]
Transform input dataframe so that building_category within groups (residential/non-residential) are unpacked into all containing categories. Duplicates categories are removed. Specific categories with values area preferred over category groups when there is a conflict.
Parameters
df : pandas.core.frame.DataFrame unique_columns : str
list of column names that should be treated as joint unique. default: [‘building_category’]
Returns
pandas.core.frame.DataFrame