Input / Output

Random

timeseries_from_distribution

hydrobox.io.random.timeseries_from_distribution(distribution='gamma', distribution_args=[10, 2], size=10, seed=None, start='now', end=None, freq='D')[source]

Generate a random time series

This function will return a pandas.Series indexed by a pandas.DatetimeIndex holding random data that is generated by the given distribution. The distribution name has to be importable from numpy.random and the distribution_args list will be passed as *args. The seed parameter will be directed to np.random.seed in order to return reproducable pseudo-random results.

Parameters:
distribution : string, default=’gamma’

Any distribution density function from numpy.random can be chosen. The distribution properties (like location or scale) can be passed with the parameter distribution_args.

distribution_args : list, None, default=[10,2]

This list will be passed as *distribution_args into the given density function. If no areguments shall be passed, distribution_args can be set to None.

size : int, default=10

Specifies the length of the produced time series.

seed : int, default=None

Will be passed to numpy.random.seed.

start : string, datetime, default=’now’

Starting point for the pandas.DatetimeIndex. Can be either a datetime or string. The string has either to be ‘now’ for using the current time step, or a Datetime string of format YYYYMMDDHHmmss, where the time (HHmmss) can be omitted. If end is used, start or size should be set to None.

end : string, datetime, defualt=None

see start.

freq : string, default=’D’

Specify the temporal resulution of the time series. This can either be used in case size is omitted, but start and end are given, or in case either start or end is omitted but size is given. Any string accepted by the freq attribute of pandas.Grouper is accepted.

Returns:
pandas.Series

See also

pandas.Grouper
further information of freq settings