srvar.data.dataset¶
- class srvar.data.dataset.Dataset(time_index, variables, values)[source]¶
Bases:
objectA lightweight container for multivariate time series data.
The library consistently represents a dataset as a matrix
valueswith shape(T, N), where:Tis the number of time points (observations)Nis the number of variables (series)
- Parameters:
time_index (
Index) – Time index for the observations. Can be apandas.Index(e.g. apandas.DatetimeIndex) or anything coercible to one.variables (
list[str]) – Variable names of lengthN.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
Datasetfrom array-like inputs.- Parameters:
values (
ndarray) – A numeric array of shape(T, N).variables (
Sequence[str]) – Sequence of variable names of lengthN.time_index (
Iterable[object] |Index|None) – Optional time index. If omitted, apandas.RangeIndexwithstart=0is used.
- Returns:
Validated dataset instance.
- Return type:
- Raises:
ValueError – If shapes are inconsistent (e.g.
len(variables) != values.shape[1]) or ifvaluesis not two-dimensional.
-
time_index:
Index¶
-
values:
ndarray¶
-
variables:
list[str]¶