Modeling: Difference between revisions

From wiki
Jump to navigation Jump to search
No edit summary
Line 2: Line 2:


=Eyeopeners=
=Eyeopeners=
Store results in a list.  
* Store results in a list.
<syntaxhighlight lang=python>
<syntaxhighlight lang=python>
for a in range(100):
for a in range(100):
Line 8: Line 8:
     funcBresults[a] = functionBcall(bla,bla)
     funcBresults[a] = functionBcall(bla,bla)
</syntaxhighlight>
</syntaxhighlight>
 
: ModSimPy is using Series from [[Pandas]] to store results. This adds handy functions.
ModSimPy is using Series from [[Pandas]] to store results. This adds handy functions.
* The state of the model is stored in a Pandas Series too.
;results.mean()
:Return the mean (average) for the items in results
 
I have not studied the pandas Series yet but this works:
<syntaxhighlight lang=python>
from modsim import *
results = TimeSeries()
for a in range(100):
    results[a] = functioncall(bla,bla)
</syntaxhighlight>
TimeSeries is a modsim modified version (subclass) of the pandas.Series class.

Revision as of 20:30, 16 December 2018

Mostly based on this paper that comes with its own modsim library.

Eyeopeners

  • Store results in a list.
for a in range(100):
    funcAresults[a] = functionAcall(bla,bla)
    funcBresults[a] = functionBcall(bla,bla)
ModSimPy is using Series from Pandas to store results. This adds handy functions.
  • The state of the model is stored in a Pandas Series too.