etna.datasets.generate_hierarchical_df#
- generate_hierarchical_df(periods: int, n_segments: ~typing.List[int], freq: ~pandas._libs.tslibs.offsets.DateOffset | str | None = <Day>, start_time: ~pandas._libs.tslibs.timestamps.Timestamp | int | str | None = None, ar_coef: list | None = None, sigma: float = 1, random_seed: int = 1) DataFrame [source]#
Create DataFrame with hierarchical structure and AR process data.
- The hierarchical structure is generated as follows:
Number of levels in the structure is the same as length of
n_segments
parameterEach level contains the number of segments set in
n_segments
Connections from parent to child level are generated randomly.
- Parameters:
periods (int) – number of timestamps
freq (DateOffset | str | None) –
frequency of timestamps, possible values:
pandas.DateOffset
object for datetime timestamppandas offset aliases for datetime timestamp
None for integer timestamp
ar_coef (list | None) – AR coefficients
sigma (float) – scale of AR noise
random_seed (int) – random seed
- Returns:
DataFrame at the bottom level of the hierarchy
- Raises:
ValueError: –
n_segments
is emptyValueError: –
n_segments
contains not positive integersValueError: –
n_segments
represents not non-decreasing sequenceValueError: – Non-integer timestamp parameter is used for integer-indexed timestamp.
- Return type: