mirror of
https://rs-loy-gitlab.concordia.ca/PMAU/DynamicBuildingSimulation.git
synced 2024-12-23 13:35:41 -05:00
33 lines
824 B
Python
33 lines
824 B
Python
|
import pandas as pd
|
||
|
import numpy as np
|
||
|
import helpers.constants as cte
|
||
|
|
||
|
|
||
|
class MonthlyValues:
|
||
|
def __init__(self):
|
||
|
self._month_hour = None
|
||
|
|
||
|
@staticmethod
|
||
|
def get_mean_values(values):
|
||
|
out = None
|
||
|
if values is not None:
|
||
|
out = pd.DataFrame(values).groupby('month', as_index=False).mean()
|
||
|
return out
|
||
|
|
||
|
@staticmethod
|
||
|
def get_total_month(values):
|
||
|
out = None
|
||
|
if values is not None:
|
||
|
out = pd.DataFrame(values).groupby('month', as_index=False).sum()
|
||
|
return out
|
||
|
|
||
|
@property
|
||
|
def month_hour(self):
|
||
|
if self._month_hour is None:
|
||
|
array = []
|
||
|
for i in range(0, 12):
|
||
|
total_hours = cte.days_of_month[i] * 24
|
||
|
array = np.concatenate((array, np.full(total_hours, i + 1)))
|
||
|
self._month_hour = pd.DataFrame(array, columns=['month'])
|
||
|
return self._month_hour
|