In [74]:
# Will allow us to embed images in the notebook
%matplotlib inline
In [75]:
# Import NEM12 data
from nemreader import output_as_data_frames
file_path = '../examples/example.csv'
dfs = output_as_data_frames(file_path)
nmi, df = dfs[0] # Get data for first NMI in file
nmi = '*Redacted*'
Energy billing data is reported by the meter at the end of the interval period.
The energy reading on 2020-01-01T00:00 is actually for the last interval of the previous day/month/year. That is 2019-12-31T23:30 to 2020-01-01T00:00 for a 30min interval reading.
So for analysis we want to report on interval start to ensure values are grouped properly.
In [76]:
df.set_index('period_start', inplace=True)
df.tail()
Out[76]:
In [77]:
#Show quick daily summary
import pandas as pd
import calplot
calplot.calplot(pd.Series(df.E1), daylabels='MTWTFSS')
Out[77]:
In [78]:
# Technically we should probably use a bar chart since they are totals
month_totals = df.groupby(df.index.strftime('%Y-%m')).sum()
month_totals.plot(title=nmi+" Monthly kWh", kind='bar', y=['E1'])
Out[78]:
In [79]:
# But a line chart resampled by month shows better date axis labels
month_totals = df.resample('M').sum()
month_totals.plot(title=nmi+" Monthly kWh", y=['E1'])
Out[79]:
In [80]:
day_totals = df.resample('W').sum()
day_totals.plot(title=nmi+" Weekly kWh", y=['E1'])
Out[80]:
In [81]:
hourly_avg = df.groupby(df.index.strftime('%H:%M')).mean()
hourly_avg.plot(title=nmi+" Avg Daily Profile", y=['E1'])
Out[81]:
In [82]:
# Filter by summer months only
summer_df = df.loc[df.index.month.isin([11, 12, 1, 2])]
summer_avg = summer_df.groupby(summer_df.index.strftime('%H:%M')).mean()
summer_avg.plot(title=nmi+" Avg Daily Profile (Hot Months)", y=['E1'])
Out[82]:
In [83]:
# Filter by winter months only
winter_df = df.loc[df.index.month.isin([5, 6, 7, 8, 9])]
winter_avg = winter_df.groupby(winter_df.index.strftime('%H:%M')).mean()
winter_avg.plot(title=nmi+" Avg Daily Profile (Cold Months)", y=['E1'])
Out[83]: