pastas / pastastore

:spaghetti: :convenience_store: Tools for managing timeseries and Pastas models

Home Page:https://pastastore.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add apply function to pastastore

dbrakenhoff opened this issue · comments

Add method to apply custom functions to entries in libraries:

func = lambda ml:  ml.get_contribution("well")
pstore.apply("models", func)

should be simple code:

def apply(self, libname, func, names=None, progressbar=True):
    names = self.conn._parse_names(names, libname)
    result = []
    for n in (tqdm(names) if progressbar else names):
        result.append(func(self.conn._get_item(libname, n)))
    return result