friendlysam.util.get_series

friendlysam.util.get_series(func, indices, **kwargs)

Get a pandas Series of function values at indices.

Equivalent to pandas.Series(index=indices, data=get_list(func, indices), **kwargs).

Parameters:
  • func (callable) – The callable to get values from.
  • indices (iterable) – An iterable of index values to pass to func.
Returns:

Values at indices.

Return type:

pandas.Series

Examples

>>> from friendlysam import Storage
>>> s = Storage('power', name='Battery')
>>> for i in range(5):
...     s.volume(i).value = i ** 2
...
>>> get_series(s.accumulation['power'], range(4))
0    1
1    3
2    5
3    7
dtype: float64