From 51df504a52757efdc106a37d1b0b426e2c571487 Mon Sep 17 00:00:00 2001 From: pilar Date: Fri, 23 Oct 2020 06:57:34 -0400 Subject: [PATCH] modified building.py for saving monthly heating and cooling values --- city_model_structure/building.py | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/city_model_structure/building.py b/city_model_structure/building.py index 68520dc4..dc75bb10 100644 --- a/city_model_structure/building.py +++ b/city_model_structure/building.py @@ -42,8 +42,8 @@ class Building(CityObject): self._type = 'building' self._monthly_heating = pd.DataFrame() self._monthly_cooling = pd.DataFrame() - self._hourly_heating = pd.DataFrame() - self._hourly_cooling = pd.DataFrame() + self._hourly_heating = [] + self._hourly_cooling = [] self._week_day_schedule = [] self._saturday_schedule = [] self._sunday_schedule = [] @@ -279,7 +279,7 @@ class Building(CityObject): self._building_units = value @property - def monthly_heating(self) -> pd.DataFrame: + def monthly_heating(self): """ building monthly heating values in Watts-hour :return: DataFrame with 12 values and a header with the source of those @@ -292,10 +292,13 @@ class Building(CityObject): building monthly heating values in Watts-hour and a header with the source :param value: DataFrame(heating demand) """ - self._monthly_heating.append(value) + if self._monthly_heating.empty: + self._monthly_heating = value + else: + self._monthly_heating = pd.concat([self._monthly_heating, value]) @property - def monthly_cooling(self) -> pd.DataFrame: + def monthly_cooling(self): """ building monthly cooling values in Watts-hour :return: DataFrame with 12 values and a header with the source of those @@ -308,10 +311,13 @@ class Building(CityObject): building monthly cooling values in Watts-hour and a header with the source :param value: DataFrame(cooling demand) """ - self._monthly_cooling.append(value) + if self._monthly_cooling.empty: + self._monthly_cooling = value + else: + self._monthly_cooling = pd.concat([self._monthly_cooling, value]) @property - def hourly_heating(self) -> pd.DataFrame: + def hourly_heating(self): """ building hourly heating values in Watts-hour :return: DataFrame with 8760 values and a header with the source of those @@ -327,7 +333,7 @@ class Building(CityObject): self._hourly_heating.append(value) @property - def hourly_cooling(self) -> pd.DataFrame: + def hourly_cooling(self): """ building hourly cooling values in Watts-hour :return: DataFrame with 8760 values and a header with the source of those