data_validation_framework.result

Util functions.

Classes

ValidationResult(is_valid[, ret_code, ...])

Class to represent a validation result as a dict.

ValidationResultSet(*args[, output_columns])

Class containing the results of a validation task.

class data_validation_framework.result.ValidationResult(is_valid, ret_code=None, comment=None, exception=None, **kwargs)

Bases: dict

Class to represent a validation result as a dict.

Some formatting is automatically executed during the dict creation:

  • if not given, the ret_code is set to 0 if is_valid is True, else it is set to 1.

  • if the given ret_code is inconsistent with the given is_valid value, a ValueError is

    raised. The ret_code can have a value greater that 1 to mark a warning. In this case, the is_valid value can be either True or False.

Parameters
  • is_valid (bool) – Validation state.

  • ret_code (int) – The return code of the validation function.

  • comment (str) – A comment to explain why the validation failed.

  • exception (str) – The exception raised by the validation function if any.

class data_validation_framework.result.ValidationResultSet(*args, output_columns=None, **kwargs)

Bases: pandas.core.frame.DataFrame

Class containing the results of a validation task.

Parameters
  • df (pandas.DataFrame) – Input DataFrame.

  • output_columns (dict) – New columns to save results in ({<column name>: <default value>})

format_data(output_columns)

Format dataframe.