srvar.data.dataset

class srvar.data.dataset.Dataset(time_index, variables, values)[source]

Bases: object

A lightweight container for multivariate time series data.

The library consistently represents a dataset as a matrix values with shape (T, N), where:

  • T is the number of time points (observations)

  • N is the number of variables (series)

Parameters:
  • time_index (Index) – Time index for the observations. Can be a pandas.Index (e.g. a pandas.DatetimeIndex) or anything coercible to one.

  • variables (list[str]) – Variable names of length N.

  • values (ndarray) – Numeric array of shape (T, N).

Notes

The class is immutable (frozen=True) and performs validation in __post_init__().

property N: int

Number of variables (columns) in the dataset.

property T: int

Number of time points (rows) in the dataset.

static from_arrays(*, values, variables, time_index=None)[source]

Construct a Dataset from array-like inputs.

Parameters:
  • values (ndarray) – A numeric array of shape (T, N).

  • variables (Sequence[str]) – Sequence of variable names of length N.

  • time_index (Iterable[object] | Index | None) – Optional time index. If omitted, a pandas.RangeIndex with start=0 is used.

Returns:

Validated dataset instance.

Return type:

Dataset

Raises:

ValueError – If shapes are inconsistent (e.g. len(variables) != values.shape[1]) or if values is not two-dimensional.

time_index: Index
values: ndarray
variables: list[str]