validation¶
The module contains functionality for a static type validation of pandas dataframes.
- class alphadia.validation.base.Property(name, type)[source]¶
Bases:
objectColumn property base class
- class alphadia.validation.base.Schema(name, properties)[source]¶
Bases:
object- __init__(name, properties)[source]¶
Schema for validating dataframes
- Parameters:
name (str) – Name of the schema
properties (list) – List of Property objects
- docstring() str[source]¶
Automatically generate a docstring for the schema.
- Returns:
Docstring for the schema
- Return type:
str
- validate(df: DataFrame, logging: bool = True, warn_on_critical_values: bool = False) None[source]¶
Validates the dataframe.
- Parameters:
df (pd.DataFrame) – Dataframe to validate
logging (bool) – If True, log the validation results. Defaults to True.
warn_on_critical_values (bool) – If True, warn on critical values like NaN and Inf in the dataframe. Defaults to False.
- Raises:
ValueError – If validation fails.