[NEMO-devel] use of Pandas data frames
Ben Elliston
bje at air.net.au
Tue Aug 29 09:18:02 AEST 2017
Hi all
I've been making some more invasive changes to NEMO on a branch which
are now ready to be merged back into the master. In the past, NEMO
kept a lot of its time series data (demand, generation, unserved
events) in one- or two-dimensional arrays indexed by the hour number
(eg 0 to 8760 for a one year simulation).
Pandas is a Python data analysis library that does a very nice job of
storing and manipulating time series data (http://pandas.pydata.org/).
Where it makes sense, I have switched various internal representations
from arrays to Pandas "data frames". A data frame has an index,
typically the time/date, and columns.
Here is an example of how much better this works:
>>> import nem
>>> c = nem.Context()
>>> c.generators[0].set_capacity(13) # produce some unserved
>>> nem.run(c)
>>> print c.unserved
Date_Time
2010-01-11 13:00:00 288.360
2010-01-11 14:00:00 445.200
2010-01-11 15:00:00 645.140
2010-01-11 16:00:00 313.530
2010-01-12 13:00:00 445.860
2010-01-12 14:00:00 378.365
2010-02-09 15:00:00 123.815
2010-02-10 13:00:00 121.550
dtype: float64
Cheers,
Ben
More information about the nemo-devel
mailing list