pastas / pastastore

:spaghetti: :convenience_store: Tools for managing timeseries and Pastas models
https://pastastore.readthedocs.io
MIT License
15 stars 4 forks source link

Add apply function to pastastore #99

Closed dbrakenhoff closed 11 months ago

dbrakenhoff commented 11 months ago

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
dbrakenhoff commented 11 months ago

Closed by #100