validate_schedule#

causalpy.historical_validation.validate_schedule(history, treated_unit, control_units, request, *, time_column=None)[source]#

Validate a historical schedule without fitting.

Parameters:
  • history (DataFrame) – Panel indexed by time, or a frame whose time axis is time_column. The caller’s frame is not mutated.

  • treated_unit (str) – The single unit the decision concerns.

  • control_units (Sequence[str]) – Donor units. Must be unique and must not include the treated unit.

  • request (ScheduleRequest) – Origins, horizons, exclusions, cadence, and policies.

  • time_column (str | None) – Column to use as the time index. Passed through causalpy.input_data.to_pandas_with_time_index().

Returns:

Every requested window, including incomplete and missing ones, plus exact endpoints and usable counts.

Return type:

HistoricalSchedule

Raises:
  • TypeError – If a duration, cadence, or unit argument has an unsupported type.

  • ValueError – If the request mixes selection and audit, names an unknown exclusion, asks for a cadence the index cannot support, puts an audit origin before a selection origin, lets a selection analysis index intersect an audit holdout, or names two origins that resolve to one history label.

  • DataException – If the history index is missing, duplicated, or not sorted.