Skip to main content

Dataset

A frame of series with their metadata, scenarios and a log of changes.

Usage

Source

Dataset(
    frame,
    series=None,
    *,
    scenarios=None,
    severity=None,
    log=(),
)

Immutable: the constructor copies frame and scenarios, the frame and scenarios properties return copies, and every method returns a new Dataset. Nothing changes the caller’s objects.

Parameters

frame: pd.DataFrame

One column per series (string names; float, integer, boolean or string values), indexed by a sorted, unique pd.PeriodIndex, or for panels by a (segment, period) MultiIndex.

series: Mapping[str, SeriesMeta | Mapping[str, Any]] | None = None

SeriesMeta per column name; a column without one gets SeriesMeta() (role other).

scenarios: pd.DataFrame | None = None

Optional future paths: a frame indexed by (scenario, period) whose columns are dataset columns, at the dataset’s frequency.

severity: Sequence[str | int] | None = None

The scenario labels from mildest to most severe, each once. Defaults to their order of first appearance.

log: Iterable[LogEntry] = ()
LogEntry records of the changes made so far, oldest first.