prepare_anchored_subjects_each
prepare_anchored_subjects_each(
estimates,
readings,
*,
forecast_source,
consensus_source=CONSENSUS_SOURCE,
lookback=_DEFAULT_LOOKBACK,
maximum_revision_age=_DEFAULT_REVISION_AGE,
)Prepare anchored subjects with one reading moment per row.
Each row equals what prepare_anchored_subjects returns for that subject when called at that row’s moment, so an event study reads every report at its own moment in one pass rather than one call per moment. An invalid panel, readings frame, source pair or reading policy raises PanelError.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| estimates | pd.DataFrame | Long input panel; arbitrary source names are supported. | required |
| readings | pd.DataFrame | One row per subject and moment: the subject columns, period_end and a UTC as_of column. | required |
| forecast_source | str | Original source to place in the forecast column. | required |
| consensus_source | str | Original source to place in the consensus column. | CONSENSUS_SOURCE |
| lookback | pd.Timedelta | Positive interval separating the consensus revision reads. | _DEFAULT_LOOKBACK |
| maximum_revision_age | pd.Timedelta | Positive maximum age at each revision read. | _DEFAULT_REVISION_AGE |
Returns
| Name | Type | Description |
|---|---|---|
| pd.DataFrame | One row per reading, in reading order, with forecast, consensus, their timestamps and ages, the revision and the reading policy. |