heatmap_data

report.heatmap_data(values, descriptor, *, x, y)

Reshape a two-parameter grid result into a matrix for a heatmap.

Joins a per-scenario value (one number per iteration, e.g. an ICER or incremental NMB) to a heormodel.dsa.grid descriptor and pivots it into a matrix over two gridded parameters. The base-case scenario is dropped.

Parameters

Name Type Description Default
values pd.Series One value per scenario, indexed by the shared iteration index. required
descriptor pd.DataFrame The grid descriptor, carrying a column per gridded parameter. required
x str Parameter to lay along the columns. required
y str Parameter to lay along the index. required

Returns

Name Type Description
pd.DataFrame DataFrame with y values as the index and x values as the
pd.DataFrame columns.

Example

import pandas as pd from heormodel.dsa import grid from heormodel.report import heatmap_data base = pd.Series({“a”: 1.0, “b”: 2.0}) design, descriptor = grid(base, {“a”: [0.0, 1.0], “b”: [10.0, 20.0]}) values = design[“a”] + design[“b”] hm = heatmap_data(values, descriptor, x=“a”, y=“b”) hm.shape (2, 2) float(hm.loc[20.0, 1.0]) 21.0