Hi,
Just started out using GE with Kedro and I have a question in how to load expectations using YAML.
This is what I have:
# nodes/int_titanic.py
def int_titanic(raw_df: pd.DataFrame, expectations_dict:Dict) -> pd.DataFrame:
"""
Intermediate layer for titanic.
Args:
raw_df (DataFrame): Raw DataFrame from titanic.csv.
Returns:
DataFrame cleaned.
"""
ge_df = ge.dataset.PandasDataset(raw_df)
# I want to be able to make this or something similar work
result = ge_df.validate(expectations_config=expectations_dict)
# Check result
if not result.success:
print(result)
raise Exception('Validation error.')
return raw_df
# conf/base/parameters.yml
int_titanic_expectations:
expectations:
-
kwargs:
column: Name
type_: str
expectation_type: expect_column_values_to_be_of_type
-
kwargs:
column: Age
type_: float
expectation_type: expect_column_values_to_be_of_type