set_shock_magnitudes()
Set the shock magnitudes for each shock parameter (growth, interest, primary balance).
Usage
set_shock_magnitudes(
ctx,
records,
*,
strict=True,
empty_measure="write",
)Defines the magnitude of the shock for each of the three possible affected parameters. Each record represents one shock magnitude cell in the shock table (Inputs!B26:D26); the SHOCK_PARAMETER field maps to the column header.
Parameters
records: SeriesInput-
A list of records, a single record dict, a tidy pandas/polars DataFrame, or a 1-D iterable of measure values in key order.
empty_measure: EmptyMeasure = "write"-
How to treat rows with missing measure values (
Noneor float NaN after DataFrame coercion). “write” (default) passes values through; “skip” drops them; “error” raises. Empty key fields always raise. Required record fields: - SHOCK_PARAMETER: The parameter affected by the shock (e.g., ‘Growth’, ‘Interest’, or ‘Primary Balance’). - OBS_VALUE: The shock magnitude applied to the parameter. Optional record fields: - PARAMETER: Constant field identifying the data as shock magnitude entries. If supplied, expected value: “shock_magnitude”. - UNIT_MEASURE: Unit of measure for the shock magnitude. If supplied, expected value: “PP”.
Returns
None: None- Applies the input updates to ctx.
Source Binding
Workbook range: Inputs!B26:D26 Layout: series Value type: float
Examples
set_shock_magnitudes(ctx, [ {‘SHOCK_PARAMETER’: ‘Growth’, ‘OBS_VALUE’: -2.0}, {‘SHOCK_PARAMETER’: ‘Interest’, ‘OBS_VALUE’: 2.0},])
set_shock_magnitudes(ctx, [-2.0, 2.0])