causalis.data_contracts.causaldata.CausalDataCausalData
Bases: pydantic.BaseModel
Container for causal inference datasets.
Wraps a pandas DataFrame and stores the names of treatment, outcome, and optional confounder columns. The stored DataFrame is restricted to only those columns. Uses Pydantic for validation and as a data_contracts contract.
Attributes
- dfpd.DataFrame
The DataFrame containing the data_contracts restricted to outcome, treatment, and confounder columns. NaN values are not allowed in the used columns.
- treatment_namestr
Column name representing the treatment variable.
- outcome_namestr
Column name representing the outcome variable.
- confounders_namesList[str]
Names of the confounder columns (may be empty).
- user_id_namestr, optional
Column name representing the unique identifier for each observation/user.
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.
Canonical target
causalis.data_contracts.causaldata.CausalData
Sections