Skip to content

Rules and registries

Aggregation and alignment semantics, and their registries.

CALENDAR_RULES module-attribute

CALENDAR_RULES = (
    "weighted_mean",
    "sum",
    "mean",
    "copy",
    "sd",
    "share",
    "logshare",
)

ALIGNMENT_RULES module-attribute

ALIGNMENT_RULES = (
    "exact",
    "drop_last",
    "drop_feb29",
    "repeat_last",
)

register_calendar_rule

register_calendar_rule(param: str, rule: str) -> dict

Record the recast rule for a value column, for every calendar.

get_calendar_rule

get_calendar_rule(param: str) -> dict | None

list_calendar_rules

list_calendar_rules() -> pa.Table

clear_calendar_rules

clear_calendar_rules(
    name: str | Sequence[str] | None = None,
) -> None

Remove calendar rules: the named value columns, or all of them.

register_calendar_conversion

register_calendar_conversion(
    source: str, target: str, fun: Callable | None
) -> str

Register a custom conversion between two named calendars, consulted by recast_calendar() before the grid route. fun=None removes it.

get_calendar_conversion

get_calendar_conversion(
    source: str, target: str
) -> Callable | None

list_calendar_conversions

list_calendar_conversions() -> pa.Table

clear_calendar_conversions

clear_calendar_conversions(
    name: str | Sequence[str] | None = None,
) -> None

Remove conversions: the named keys ("a->b"), or all of them.