geost.validation.safe_validate#

geost.validation.safe_validate(schema: DataFrameSchema, df: DataFrame, **kwargs) DataFrame[source]#

Catch validation errors and raise a warning instead while returning the DataFrame unchanged. If rows are dropped due to validation, report which rows were dropped.

Parameters:
  • schema (DataFrameSchema) – The schema to validate the DataFrame against.

  • df (pd.DataFrame) – The DataFrame to validate.

  • **kwargs (keyword arguments) – Additional arguments to pass to the Pandera DataFrameSchema.validate method. Note that the inplace argument is ignored and the DataFrame will not be modified in place. i.e. this function always returns a DataFrame.

Returns:

Either the validated (and possibly changed) DataFrame or the unchanged DataFrame if validation failed.

Return type:

pd.DataFrame