modelhelp module

Created on Tue Mar 7 10:38:28 2017

@author: hanseni

utilities for Stampe models

modelhelp.update_var(databank, xvar, operator='=', inputval=0, start='', end='', create=1, lprint=False, scale=1.0)[source]

Updates a variable in the databank. Possible update choices are: n = : val = inputval n + : val = val + inputval n - : val = val - inputval n * : val = val * inputval n =growth : val = val(t-1)+inputval + n % : val = val(1+inputval/100) n n scale scales the input variables default =1.0

modelhelp.tovarlag(var, lag)[source]

creates a stringof var(lag) if lag else just lag

modelhelp.cutout(input, threshold=0.0)[source]

get rid of rows below treshold and returns the dataframe or serie

modelhelp.ttimer(input='test', show=True, short=False)[source]

A timer context manager, implemented using a generator function. This one will report time even if an exception occurs”””

Parameters:
  • input (string, optional) – a name. The default is ‘test’.

  • show (bool, optional) – show the results. The default is True.

  • short (bool, optional) – . The default is False.

Return type:

None.

modelhelp.finddec(df)[source]

find a suitable number of decimal places from the magnitudes of a dataframe

modelhelp.insertModelVar(dataframe, model=None)[source]

Inserts all variables from model, not already in the dataframe. Model can be a list of models

modelhelp.df_extend(df, add=5)[source]

Extends a Dataframe, assumes that the indes is of period_range type