In [1]:
%matplotlib inline
In [2]:
%run eqsimparsing.py
I'm importing seaborn because I like it, but this is just plot styling... feel free to delete this following cell
In [3]:
import seaborn as sns
sns.set(style="white", context="talk")
pv_a_dict
and sv_a_dict
are dictionaries where the values are Pandas dataframes
In [4]:
pv_a_dict.keys()
Out[4]:
In [5]:
type(pv_a_dict['CHILLERS'])
Out[5]:
In [6]:
pv_a_dict['PUMPS']
Out[6]:
In [7]:
pv_a_dict['PUMPS'].ix[:, 'W/GPM'].plot(kind='bar', figsize=(16,9), title='Pump W/GPM', color='#EB969C',);
sns.despine()
plt.show();
In [8]:
pv_a_dict['BOILERS']
Out[8]:
In [9]:
sv_a_dict['Fans'].ix[:,'W/CFM'].plot(kind='barh', figsize=(12,10), color='#EB969C', title='Fan W/CFM')
sns.despine()
plt.show();
In [10]:
sv_a_dict.keys()
Out[10]:
In [11]:
sys = sv_a_dict['Systems']
sys.head()
Out[11]:
In [ ]:
In [12]:
# Calculating Max People/sqft
sys['Max People/sqft'] = sys['Max People'] / sys['Floor Area (sqft)']
In [13]:
# Sorting and returning top 10
sys.sort_values(by='Max People/sqft', ascending=False).head(10)
Out[13]:
In [14]:
zones = sv_a_dict['Zones']
zones.head(10)
Out[14]:
In [15]:
def custom_apply_zones(x):
""" Aggregate zone data to the system level
For the zones, some columns should be summed (CFM, Capacity, etc)
But others should be averaged
"""
# For these three columns, do a mean
if x.name in ['Minimum Flow (Frac)', 'Sensible (FRAC)', 'W/CFM']:
return np.mean(x)
# For the rest, do a sum
else:
return np.sum(x)
In [16]:
# After the groupby, the apply applies to each group dataframe. So I use a lambda x to apply to each column
zones_agg_metrics = zones.groupby(level='System').apply(lambda x: x.apply(custom_apply_zones))
# Recalc a weighted W/CFM
zones_agg_metrics['W/CFM'] = zones_agg_metrics['Fan (kW)'] * 1000 / zones_agg_metrics['Supply Flow (CFM)']
zones_agg_metrics.head()
Out[16]:
In [17]:
fans = sv_a_dict['Fans']
In [18]:
fans
Out[18]:
In [19]:
fans.groupby(level='System').apply(sum)['Power Demand (kW)'].sort_values(inplace=False).plot(kind='barh',
figsize=(12,10), color='#EB969C',
title='System wide fan power demand (kW)')
sns.despine()
plt.show();