# `causalis.data_contracts.panel_data_scm`

## Module Contents

### Classes

`PanelDataSCM` | Validated long-format panel contract for Synthetic Control estimators.

### Data

`TimeLike` |

### API

causalis.data_contracts.panel_data_scm.TimeLike

  None

class causalis.data_contracts.panel_data_scm.PanelDataSCM(/, **data: Any)

  Bases: `pydantic.BaseModel`

  Validated long-format panel contract for Synthetic Control estimators.

  Required fields

  df : pandas.DataFrame Long-format panel data. y : str Outcome column name in `df`. unit_col : str Unit identifier column name in `df`. time_col : str Calendar time column name in `df`. Preferred input format is `pandas.Period` values with a regular frequency (for example monthly `Period['M']`). Datetime/string values are accepted only when a regular frequency can be inferred. treated_time : str Binary treatment-assignment column in `df` (0/1 or False/True).

  Notes

  There are no optional contract fields. Extra keyword arguments are rejected. The contract derives `treated_unit`, `treatment_start`, and `time_freq` from the input data. The model stores a validated internal dataframe snapshot used by all contract methods; mutating the public `df` attribute after construction does not affect validated contract behavior. Outcome `y` must not contain null/NaN values. Represent missing panel periods by omitting unit-time rows, not by keeping rows with `NaN` outcome. For fiscal quarter/year semantics, pass `time_col` explicitly as `pandas.Period` with the desired fiscal frequency.

  Initialization

  Create a new model by parsing and validating input data from keyword arguments.

  Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

  `self` is explicitly positional-only to allow `self` as a field name.

  model_config

    ‘ConfigDict(…)’

  df: pandas.DataFrame

    ‘Field(…)’

  y: str

    ‘Field(…)’

  unit_col: str

    ‘Field(…)’

  time_col: str

    ‘Field(…)’

  treated_time: str

    ‘Field(…)’

  property treated_unit: Hashable
  property treatment_start: pandas.Period
  property time_freq: str
  property n_pre_periods: int
  property n_post_periods: int
  property last_post_period: pandas.Period
  donor_pool() → Sequence[Hashable]
  df_analysis() → pandas.DataFrame
  pre_times() → Sequence[pandas.Period]
  post_times() → Sequence[pandas.Period]
  analysis_times() → Sequence[pandas.Period]
  time_to_index() → dict[pandas.Period, int]
  treatment_start_idx() → int
  __repr__() → str