Skip to content

Utilities

Pivot

from tempora.datasets import Pivot

Class: Pivot.

Pivot settings for datasets in EAV/long format.

Pivot(
    on: str,
    using: str,
    agg_function: str | dict[str, str],
    in_values: list[str] | None = None,
    dtype: str | np.dtype | dict[str, str | np.dtype] | None = None,
    errors: Literal['raise', 'coerce'] = 'coerce'
)

Parameters

Name Description
on Column whose values become new column names.
using Column providing values for the new columns.
agg_function Aggregate function (single function or per-column map).
in_values Restrict which values of on become columns.
dtype Target dtype(s) for new columns.
errors Error handling for dtype conversion.