consensus_revision
consensus_revision(
estimates,
as_of,
*,
lookback=_DEFAULT_LOOKBACK,
maximum_age=None,
source=CONSENSUS_SOURCE,
)Compute how far the consensus has moved over a lookback window.
Both the current and the prior consensus are read through postforecast.anchor.latest_before, with maximum_age passed to both, so neither is ever read past its own known_at.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| estimates | pd.DataFrame | Long input panel. | required |
| as_of | pd.Timestamp | The moment to read the current consensus at. | required |
| lookback | pd.Timedelta | Positive interval before as_of; invalid values raise PanelError. | _DEFAULT_LOOKBACK |
| maximum_age | pd.Timedelta | None | Passed to both reads; discards a consensus older than this relative to its own reading moment. None keeps every estimate, however stale. | None |
| source | str | The source name that counts as consensus. | CONSENSUS_SOURCE |
Returns
| Name | Type | Description |
|---|---|---|
| pd.DataFrame | One row per subject: the subject columns, plus consensus_revision (float), consensus_prior (float) and consensus_prior_known_at (datetime). consensus_revision is NaN when the prior consensus is absent, zero or negative, since a missing prior means no revision was observed, not a revision of zero. |