great_expectations.dataset

Package Contents

Classes

Dataset(*args, **kwargs)

Holds expectation decorators.

MetaPandasDataset(*args, **kwargs)

MetaPandasDataset is a thin layer between Dataset and PandasDataset.

PandasDataset(*args, **kwargs)

PandasDataset instantiates the great_expectations Expectations API as a subclass of a pandas.DataFrame.

class great_expectations.dataset.Dataset(*args, **kwargs)

Bases: great_expectations.dataset.dataset.MetaDataset

Holds expectation decorators.

_data_asset_type = Dataset
_supports_row_condition = False
hashable_getters = ['get_column_min', 'get_column_max', 'get_column_mean', 'get_column_modes', 'get_column_median', 'get_column_quantiles', 'get_column_nonnull_count', 'get_column_stdev', 'get_column_sum', 'get_column_unique_count', 'get_column_value_counts', 'get_row_count', 'get_column_count', 'get_table_columns', 'get_column_count_in_range']
classmethod from_dataset(cls, dataset=None)

This base implementation naively passes arguments on to the real constructor, which is suitable really when a constructor knows to take its own type. In general, this should be overridden

abstract get_row_count(self)

Returns: int, table row count

abstract get_column_count(self)

Returns: int, table column count

abstract get_table_columns(self)

Returns: List[str], list of column names

abstract get_column_nonnull_count(self, column)

Returns: int

abstract get_column_mean(self, column)

Returns: float

abstract get_column_value_counts(self, column, sort='value', collate=None)

Get a series containing the frequency counts of unique values from the named column.

Parameters
  • column – the column for which to obtain value_counts

  • sort (string) – must be one of “value”, “count”, or “none”. - if “value” then values in the resulting partition object will be sorted lexigraphically - if “count” then values will be sorted according to descending count (frequency) - if “none” then values will not be sorted

  • collate (string) – the collate (sort) method to be used on supported backends (SqlAlchemy only)

Returns

pd.Series of value counts for a column, sorted according to the value requested in sort

abstract get_column_sum(self, column)

Returns: float

abstract get_column_max(self, column, parse_strings_as_datetimes=False)

Returns: Any

abstract get_column_min(self, column, parse_strings_as_datetimes=False)

Returns: Any

abstract get_column_unique_count(self, column)

Returns: int

abstract get_column_modes(self, column)

Returns: List[Any], list of modes (ties OK)

abstract get_column_median(self, column)

Returns: Any

abstract get_column_quantiles(self, column, quantiles, allow_relative_error=False)

Get the values in column closest to the requested quantiles :param column: name of column :type column: string :param quantiles: the quantiles to return. quantiles must be a tuple to ensure caching is possible :type quantiles: tuple of float

Returns

the nearest values in the dataset to those quantiles

Return type

List[Any]

abstract get_column_stdev(self, column)

Returns: float

get_column_partition(self, column, bins='uniform', n_bins=10, allow_relative_error=False)

Get a partition of the range of values in the specified column.

Parameters
  • column – the name of the column

  • bins – ‘uniform’ for evenly spaced bins or ‘quantile’ for bins spaced according to quantiles

  • n_bins – the number of bins to produce

  • allow_relative_error – passed to get_column_quantiles, set to False for only precise values, True to allow approximate values on systems with only binary choice (e.g. Redshift), and to a value between zero and one for systems that allow specification of relative error (e.g. SparkDFDataset).

Returns

A list of bins

abstract get_column_hist(self, column, bins)

Get a histogram of column values :param column: the column for which to generate the histogram :param bins: the bins to slice the histogram. bins must be a tuple to ensure caching is possible :type bins: tuple

Returns: List[int], a list of counts corresponding to bins

abstract get_column_count_in_range(self, column, min_val=None, max_val=None, strict_min=False, strict_max=True)

Returns: int

abstract get_crosstab(self, column_A, column_B, bins_A=None, bins_B=None, n_bins_A=None, n_bins_B=None)

Get crosstab of column_A and column_B, binning values if necessary

test_column_map_expectation_function(self, function, *args, **kwargs)

Test a column map expectation function

Parameters
  • function (func) – The function to be tested. (Must be a valid column_map_expectation function.)

  • *args – Positional arguments to be passed the the function

  • **kwargs – Keyword arguments to be passed the the function

Returns

An ExpectationSuiteValidationResult

Notes

This function is a thin layer to allow quick testing of new expectation functions, without having to define custom classes, etc. To use developed expectations from the command-line tool, you’ll still need to define custom classes, etc.

Check out How to create custom Expectations for more information.

test_column_aggregate_expectation_function(self, function, *args, **kwargs)

Test a column aggregate expectation function

Parameters
  • function (func) – The function to be tested. (Must be a valid column_aggregate_expectation function.)

  • *args – Positional arguments to be passed the the function

  • **kwargs – Keyword arguments to be passed the the function

Returns

An ExpectationSuiteValidationResult

Notes

This function is a thin layer to allow quick testing of new expectation functions, without having to define custom classes, etc. To use developed expectations from the command-line tool, you’ll still need to define custom classes, etc.

Check out How to create custom Expectations for more information.

expect_column_to_exist(self, column, column_index=None, result_format=None, include_config=True, catch_exceptions=None, meta=None)

Expect the specified column to exist.

expect_column_to_exist is a expectation, not a column_map_expectation or column_aggregate_expectation.

Parameters

column (str) – The column name.

Other Parameters
  • column_index (int or None) – If not None, checks the order of the columns. The expectation will fail if the column is not in location column_index (zero-indexed).

  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

expect_table_columns_to_match_ordered_list(self, column_list, result_format=None, include_config=True, catch_exceptions=None, meta=None)

Expect the columns to exactly match a specified list.

expect_table_columns_to_match_ordered_list is a expectation, not a column_map_expectation or column_aggregate_expectation.

Parameters

column_list (list of str) – The column names, in the correct order.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

expect_table_columns_to_match_set(self, column_set: Optional[Union[Set[str], List[str]]], exact_match: Optional[bool] = True, result_format=None, include_config=True, catch_exceptions=None, meta=None)

Expect the columns to match a specified set.

expect_table_columns_to_match_set is a expectation, not a column_map_expectation or column_aggregate_expectation.

Parameters
  • column_set (set of str or list of str) – The column names you wish to check. If given a list, it will be converted to a set before processing. Column names are case sensitive.

  • exact_match (bool) – Whether to make sure there are no extra columns in either the dataset or in the column_set.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

expect_table_column_count_to_be_between(self, min_value=None, max_value=None, result_format=None, include_config=True, catch_exceptions=None, meta=None)

Expect the number of columns to be between two values.

expect_table_column_count_to_be_between is a expectation, not a column_map_expectation or column_aggregate_expectation.

Keyword Arguments
  • min_value (int or None) – The minimum number of columns, inclusive.

  • max_value (int or None) – The maximum number of columns, inclusive.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

Notes

  • min_value and max_value are both inclusive.

  • If min_value is None, then max_value is treated as an upper bound, and the number of acceptable columns has no minimum.

  • If max_value is None, then min_value is treated as a lower bound, and the number of acceptable columns has no maximum.

See also

expect_table_column_count_to_equal

expect_table_column_count_to_equal(self, value, result_format=None, include_config=True, catch_exceptions=None, meta=None)

Expect the number of columns to equal a value.

expect_table_column_count_to_equal is a expectation, not a column_map_expectation or column_aggregate_expectation.

Parameters

value (int) – The expected number of columns.

Other Parameters
  • result_format (string or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

See also

expect_table_column_count_to_be_between

expect_table_row_count_to_be_between(self, min_value=None, max_value=None, result_format=None, include_config=True, catch_exceptions=None, meta=None)

Expect the number of rows to be between two values.

expect_table_row_count_to_be_between is a expectation, not a column_map_expectation or column_aggregate_expectation.

Keyword Arguments
  • min_value (int or None) – The minimum number of rows, inclusive.

  • max_value (int or None) – The maximum number of rows, inclusive.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

Notes

  • min_value and max_value are both inclusive.

  • If min_value is None, then max_value is treated as an upper bound, and the number of acceptable rows has no minimum.

  • If max_value is None, then min_value is treated as a lower bound, and the number of acceptable rows has no maximum.

See also

expect_table_row_count_to_equal

expect_table_row_count_to_equal(self, value, result_format=None, include_config=True, catch_exceptions=None, meta=None)

Expect the number of rows to equal a value.

expect_table_row_count_to_equal is a expectation, not a column_map_expectation or column_aggregate_expectation.

Parameters

value (int) – The expected number of rows.

Other Parameters
  • result_format (string or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

See also

expect_table_row_count_to_be_between

abstract expect_column_values_to_be_unique(self, column, mostly=None, result_format=None, row_condition=None, condition_parser=None, include_config=True, catch_exceptions=None, meta=None)

Expect each column value to be unique.

This expectation detects duplicates. All duplicated values are counted as exceptions.

For example, [1, 2, 3, 3, 3] will return [3, 3, 3] in result.exceptions_list, with unexpected_percent = 60.0.

expect_column_values_to_be_unique is a column_map_expectation.

Parameters

column (str) – The column name.

Keyword Arguments

mostly (None or a float between 0 and 1) – Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

abstract expect_column_values_to_not_be_null(self, column, mostly=None, result_format=None, row_condition=None, condition_parser=None, include_config=True, catch_exceptions=None, meta=None)

Expect column values to not be null.

To be counted as an exception, values must be explicitly null or missing, such as a NULL in PostgreSQL or an np.NaN in pandas. Empty strings don’t count as null unless they have been coerced to a null type.

expect_column_values_to_not_be_null is a column_map_expectation.

Parameters

column (str) – The column name.

Keyword Arguments

mostly (None or a float between 0 and 1) – Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

abstract expect_column_values_to_be_null(self, column, mostly=None, result_format=None, row_condition=None, condition_parser=None, include_config=True, catch_exceptions=None, meta=None)

Expect column values to be null.

expect_column_values_to_be_null is a column_map_expectation.

Parameters

column (str) – The column name.

Keyword Arguments

mostly (None or a float between 0 and 1) – Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

abstract expect_column_values_to_be_of_type(self, column, type_, mostly=None, result_format=None, row_condition=None, condition_parser=None, include_config=True, catch_exceptions=None, meta=None)

Expect a column to contain values of a specified data type.

expect_column_values_to_be_of_type is a column_aggregate_expectation for typed-column backends, and also for PandasDataset where the column dtype and provided type_ are unambiguous constraints (any dtype except ‘object’ or dtype of ‘object’ with type_ specified as ‘object’).

For PandasDataset columns with dtype of ‘object’ expect_column_values_to_be_of_type is a column_map_expectation and will independently check each row’s type.

Parameters
  • column (str) – The column name.

  • type\_ (str) – A string representing the data type that each column should have as entries. Valid types are defined by the current backend implementation and are dynamically loaded. For example, valid types for PandasDataset include any numpy dtype values (such as ‘int64’) or native python types (such as ‘int’), whereas valid types for a SqlAlchemyDataset include types named by the current driver such as ‘INTEGER’ in most SQL dialects and ‘TEXT’ in dialects such as postgresql. Valid types for SparkDFDataset include ‘StringType’, ‘BooleanType’ and other pyspark-defined type names.

Keyword Arguments

mostly (None or a float between 0 and 1) – Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

abstract expect_column_values_to_be_in_type_list(self, column, type_list, mostly=None, result_format=None, row_condition=None, condition_parser=None, include_config=True, catch_exceptions=None, meta=None)

Expect a column to contain values from a specified type list.

expect_column_values_to_be_in_type_list is a column_aggregate_expectation for typed-column backends, and also for PandasDataset where the column dtype provides an unambiguous constraints (any dtype except ‘object’). For PandasDataset columns with dtype of ‘object’ expect_column_values_to_be_of_type is a column_map_expectation and will independently check each row’s type.

Parameters
  • column (str) – The column name.

  • type_list (str) – A list of strings representing the data type that each column should have as entries. Valid types are defined by the current backend implementation and are dynamically loaded. For example, valid types for PandasDataset include any numpy dtype values (such as ‘int64’) or native python types (such as ‘int’), whereas valid types for a SqlAlchemyDataset include types named by the current driver such as ‘INTEGER’ in most SQL dialects and ‘TEXT’ in dialects such as postgresql. Valid types for SparkDFDataset include ‘StringType’, ‘BooleanType’ and other pyspark-defined type names.

Keyword Arguments

mostly (None or a float between 0 and 1) – Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

abstract expect_column_values_to_be_in_set(self, column, value_set, mostly=None, parse_strings_as_datetimes=None, result_format=None, row_condition=None, condition_parser=None, include_config=True, catch_exceptions=None, meta=None)

Expect each column value to be in a given set.

For example:

# my_df.my_col = [1,2,2,3,3,3]
>>> my_df.expect_column_values_to_be_in_set(
    "my_col",
    [2,3]
)
{
  "success": false
  "result": {
    "unexpected_count": 1
    "unexpected_percent": 16.66666666666666666,
    "unexpected_percent_nonmissing": 16.66666666666666666,
    "partial_unexpected_list": [
      1
    ],
  },
}

expect_column_values_to_be_in_set is a column_map_expectation.

Parameters
  • column (str) – The column name.

  • value_set (set-like) – A set of objects used for comparison.

Keyword Arguments
  • mostly (None or a float between 0 and 1) – Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly.

  • parse_strings_as_datetimes (boolean or None) – If True values provided in value_set will be parsed as datetimes before making comparisons.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

abstract expect_column_values_to_not_be_in_set(self, column, value_set, mostly=None, parse_strings_as_datetimes=None, result_format=None, row_condition=None, condition_parser=None, include_config=True, catch_exceptions=None, meta=None)

Expect column entries to not be in the set.

For example:

# my_df.my_col = [1,2,2,3,3,3]
>>> my_df.expect_column_values_to_not_be_in_set(
    "my_col",
    [1,2]
)
{
  "success": false
  "result": {
    "unexpected_count": 3
    "unexpected_percent": 50.0,
    "unexpected_percent_nonmissing": 50.0,
    "partial_unexpected_list": [
      1, 2, 2
    ],
  },
}

expect_column_values_to_not_be_in_set is a column_map_expectation.

Parameters
  • column (str) – The column name.

  • value_set (set-like) – A set of objects used for comparison.

Keyword Arguments

mostly (None or a float between 0 and 1) – Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

abstract expect_column_values_to_be_between(self, column, min_value=None, max_value=None, strict_min=False, strict_max=False, allow_cross_type_comparisons=None, parse_strings_as_datetimes=False, output_strftime_format=None, mostly=None, row_condition=None, condition_parser=None, result_format=None, include_config=True, catch_exceptions=None, meta=None)

Expect column entries to be between a minimum value and a maximum value (inclusive).

expect_column_values_to_be_between is a column_map_expectation.

Parameters
  • column (str) – The column name.

  • min_value (comparable type or None) – The minimum value for a column entry.

  • max_value (comparable type or None) – The maximum value for a column entry.

Keyword Arguments
  • strict_min (boolean) – If True, values must be strictly larger than min_value, default=False

  • strict_max (boolean) – If True, values must be strictly smaller than max_value, default=False allow_cross_type_comparisons (boolean or None) : If True, allow comparisons between types (e.g. integer and string). Otherwise, attempting such comparisons will raise an exception.

  • parse_strings_as_datetimes (boolean or None) – If True, parse min_value, max_value, and all non-null column values to datetimes before making comparisons.

  • output_strftime_format (str or None) – A valid strfime format for datetime output. Only used if parse_strings_as_datetimes=True.

  • mostly (None or a float between 0 and 1) – Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

Notes

  • min_value and max_value are both inclusive unless strict_min or strict_max are set to True.

  • If min_value is None, then max_value is treated as an upper bound, and there is no minimum value checked.

  • If max_value is None, then min_value is treated as a lower bound, and there is no maximum value checked.

abstract expect_column_values_to_be_increasing(self, column, strictly=None, parse_strings_as_datetimes=False, mostly=None, row_condition=None, condition_parser=None, result_format=None, include_config=True, catch_exceptions=None, meta=None)

Expect column values to be increasing.

By default, this expectation only works for numeric or datetime data. When parse_strings_as_datetimes=True, it can also parse strings to datetimes.

If strictly=True, then this expectation is only satisfied if each consecutive value is strictly increasing–equal values are treated as failures.

expect_column_values_to_be_increasing is a column_map_expectation.

Parameters

column (str) – The column name.

Keyword Arguments
  • strictly (Boolean or None) – If True, values must be strictly greater than previous values

  • parse_strings_as_datetimes (boolean or None) – If True, all non-null column values to datetimes before making comparisons

  • mostly (None or a float between 0 and 1) – Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

abstract expect_column_values_to_be_decreasing(self, column, strictly=None, parse_strings_as_datetimes=False, mostly=None, row_condition=None, condition_parser=None, result_format=None, include_config=True, catch_exceptions=None, meta=None)

Expect column values to be decreasing.

By default, this expectation only works for numeric or datetime data. When parse_strings_as_datetimes=True, it can also parse strings to datetimes.

If strictly=True, then this expectation is only satisfied if each consecutive value is strictly decreasing–equal values are treated as failures.

expect_column_values_to_be_decreasing is a column_map_expectation.

Parameters

column (str) – The column name.

Keyword Arguments
  • strictly (Boolean or None) – If True, values must be strictly greater than previous values

  • parse_strings_as_datetimes (boolean or None) – If True, all non-null column values to datetimes before making comparisons

  • mostly (None or a float between 0 and 1) – Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

abstract expect_column_value_lengths_to_be_between(self, column, min_value=None, max_value=None, mostly=None, row_condition=None, condition_parser=None, result_format=None, include_config=True, catch_exceptions=None, meta=None)

Expect column entries to be strings with length between a minimum value and a maximum value (inclusive).

This expectation only works for string-type values. Invoking it on ints or floats will raise a TypeError.

expect_column_value_lengths_to_be_between is a column_map_expectation.

Parameters

column (str) – The column name.

Keyword Arguments
  • min_value (int or None) – The minimum value for a column entry length.

  • max_value (int or None) – The maximum value for a column entry length.

  • mostly (None or a float between 0 and 1) – Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

Notes

  • min_value and max_value are both inclusive.

  • If min_value is None, then max_value is treated as an upper bound, and the number of acceptable rows has no minimum.

  • If max_value is None, then min_value is treated as a lower bound, and the number of acceptable rows has no maximum.

abstract expect_column_value_lengths_to_equal(self, column, value, mostly=None, result_format=None, row_condition=None, condition_parser=None, include_config=True, catch_exceptions=None, meta=None)

Expect column entries to be strings with length equal to the provided value.

This expectation only works for string-type values. Invoking it on ints or floats will raise a TypeError.

expect_column_values_to_be_between is a column_map_expectation.

Parameters
  • column (str) – The column name.

  • value (int or None) – The expected value for a column entry length.

Keyword Arguments

mostly (None or a float between 0 and 1) – Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

abstract expect_column_values_to_match_regex(self, column, regex, mostly=None, result_format=None, row_condition=None, condition_parser=None, include_config=True, catch_exceptions=None, meta=None)

Expect column entries to be strings that match a given regular expression. Valid matches can be found anywhere in the string, for example “[at]+” will identify the following strings as expected: “cat”, “hat”, “aa”, “a”, and “t”, and the following strings as unexpected: “fish”, “dog”.

expect_column_values_to_match_regex is a column_map_expectation.

Parameters
  • column (str) – The column name.

  • regex (str) – The regular expression the column entries should match.

Keyword Arguments

mostly (None or a float between 0 and 1) – Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

abstract expect_column_values_to_not_match_regex(self, column, regex, mostly=None, result_format=None, row_condition=None, condition_parser=None, include_config=True, catch_exceptions=None, meta=None)

Expect column entries to be strings that do NOT match a given regular expression. The regex must not match any portion of the provided string. For example, “[at]+” would identify the following strings as expected: “fish”, “dog”, and the following as unexpected: “cat”, “hat”.

expect_column_values_to_not_match_regex is a column_map_expectation.

Parameters
  • column (str) – The column name.

  • regex (str) – The regular expression the column entries should NOT match.

Keyword Arguments

mostly (None or a float between 0 and 1) – Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

abstract expect_column_values_to_match_regex_list(self, column, regex_list, match_on='any', mostly=None, result_format=None, row_condition=None, condition_parser=None, include_config=True, catch_exceptions=None, meta=None)

Expect the column entries to be strings that can be matched to either any of or all of a list of regular expressions. Matches can be anywhere in the string.

expect_column_values_to_match_regex_list is a column_map_expectation.

Parameters
  • column (str) – The column name.

  • regex_list (list) – The list of regular expressions which the column entries should match

Keyword Arguments
  • match_on= (string) – “any” or “all”. Use “any” if the value should match at least one regular expression in the list. Use “all” if it should match each regular expression in the list.

  • mostly (None or a float between 0 and 1) – Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

abstract expect_column_values_to_not_match_regex_list(self, column, regex_list, mostly=None, result_format=None, row_condition=None, condition_parser=None, include_config=True, catch_exceptions=None, meta=None)

Expect the column entries to be strings that do not match any of a list of regular expressions. Matches can be anywhere in the string.

expect_column_values_to_not_match_regex_list is a column_map_expectation.

Parameters
  • column (str) – The column name.

  • regex_list (list) – The list of regular expressions which the column entries should not match

Keyword Arguments

mostly (None or a float between 0 and 1) – Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

abstract expect_column_values_to_match_strftime_format(self, column, strftime_format, mostly=None, result_format=None, row_condition=None, condition_parser=None, include_config=True, catch_exceptions=None, meta=None)

Expect column entries to be strings representing a date or time with a given format.

expect_column_values_to_match_strftime_format is a column_map_expectation.

Parameters
  • column (str) – The column name.

  • strftime_format (str) – A strftime format string to use for matching

Keyword Arguments

mostly (None or a float between 0 and 1) – Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

abstract expect_column_values_to_be_dateutil_parseable(self, column, mostly=None, result_format=None, row_condition=None, condition_parser=None, include_config=True, catch_exceptions=None, meta=None)

Expect column entries to be parsable using dateutil.

expect_column_values_to_be_dateutil_parseable is a column_map_expectation.

Parameters

column (str) – The column name.

Keyword Arguments

mostly (None or a float between 0 and 1) – Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

abstract expect_column_values_to_be_json_parseable(self, column, mostly=None, result_format=None, row_condition=None, condition_parser=None, include_config=True, catch_exceptions=None, meta=None)

Expect column entries to be data written in JavaScript Object Notation.

expect_column_values_to_be_json_parseable is a column_map_expectation.

Parameters

column (str) – The column name.

Keyword Arguments

mostly (None or a float between 0 and 1) – Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

abstract expect_column_values_to_match_json_schema(self, column, json_schema, mostly=None, result_format=None, row_condition=None, condition_parser=None, include_config=True, catch_exceptions=None, meta=None)

Expect column entries to be JSON objects matching a given JSON schema.

expect_column_values_to_match_json_schema is a column_map_expectation.

Parameters

column (str) – The column name.

Keyword Arguments

mostly (None or a float between 0 and 1) – Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

abstract expect_column_parameterized_distribution_ks_test_p_value_to_be_greater_than(self, column, distribution, p_value=0.05, params=None, result_format=None, row_condition=None, condition_parser=None, include_config=True, catch_exceptions=None, meta=None)

Expect the column values to be distributed similarly to a scipy distribution. This expectation compares the provided column to the specified continuous distribution with a parametric Kolmogorov-Smirnov test. The K-S test compares the provided column to the cumulative density function (CDF) of the specified scipy distribution. If you don’t know the desired distribution shape parameters, use the ge.dataset.util.infer_distribution_parameters() utility function to estimate them.

It returns ‘success’=True if the p-value from the K-S test is greater than or equal to the provided p-value.

expect_column_parameterized_distribution_ks_test_p_value_to_be_greater_than is a column_aggregate_expectation.

Parameters
  • column (str) – The column name.

  • distribution (str) – The scipy distribution name. See: https://docs.scipy.org/doc/scipy/reference/stats.html Currently supported distributions are listed in the Notes section below.

  • p_value (float) – The threshold p-value for a passing test. Default is 0.05.

  • params (dict or list) – A dictionary or positional list of shape parameters that describe the distribution you want to test the data against. Include key values specific to the distribution from the appropriate scipy distribution CDF function. ‘loc’ and ‘scale’ are used as translational parameters. See https://docs.scipy.org/doc/scipy/reference/stats.html#continuous-distributions

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

Notes

These fields in the result object are customized for this expectation:

{
    "details":
        "expected_params" (dict): The specified or inferred parameters of the distribution to test                         against
        "ks_results" (dict): The raw result of stats.kstest()
}
  • The Kolmogorov-Smirnov test’s null hypothesis is that the column is similar to the provided distribution.

  • Supported scipy distributions:

    • norm

    • beta

    • gamma

    • uniform

    • chi2

    • expon

expect_column_distinct_values_to_be_in_set(self, column, value_set, parse_strings_as_datetimes=None, result_format=None, include_config=True, catch_exceptions=None, meta=None)

Expect the set of distinct column values to be contained by a given set.

The success value for this expectation will match that of expect_column_values_to_be_in_set. However, expect_column_distinct_values_to_be_in_set is a column_aggregate_expectation.

For example:

# my_df.my_col = [1,2,2,3,3,3]
>>> my_df.expect_column_distinct_values_to_be_in_set(
    "my_col",
    [2, 3, 4]
)
{
  "success": false
  "result": {
    "observed_value": [1,2,3],
    "details": {
      "value_counts": [
        {
          "value": 1,
          "count": 1
        },
        {
          "value": 2,
          "count": 1
        },
        {
          "value": 3,
          "count": 1
        }
      ]
    }
  }
}
Parameters
  • column (str) – The column name.

  • value_set (set-like) – A set of objects used for comparison.

Keyword Arguments

parse_strings_as_datetimes (boolean or None) – If True values provided in value_set will be parsed as datetimes before making comparisons.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

expect_column_distinct_values_to_equal_set(self, column, value_set, parse_strings_as_datetimes=None, result_format=None, include_config=True, catch_exceptions=None, meta=None)

Expect the set of distinct column values to equal a given set.

In contrast to expect_column_distinct_values_to_contain_set() this ensures not only that a certain set of values are present in the column but that these and only these values are present.

expect_column_distinct_values_to_equal_set is a column_aggregate_expectation.

For example:

# my_df.my_col = [1,2,2,3,3,3]
>>> my_df.expect_column_distinct_values_to_equal_set(
    "my_col",
    [2,3]
)
{
  "success": false
  "result": {
    "observed_value": [1,2,3]
  },
}
Parameters
  • column (str) – The column name.

  • value_set (set-like) – A set of objects used for comparison.

Keyword Arguments

parse_strings_as_datetimes (boolean or None) – If True values provided in value_set will be parsed as datetimes before making comparisons.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

expect_column_distinct_values_to_contain_set(self, column, value_set, parse_strings_as_datetimes=None, result_format=None, include_config=True, catch_exceptions=None, meta=None)

Expect the set of distinct column values to contain a given set.

In contrast to expect_column_values_to_be_in_set() this ensures not that all column values are members of the given set but that values from the set must be present in the column.

expect_column_distinct_values_to_contain_set is a column_aggregate_expectation.

For example:

# my_df.my_col = [1,2,2,3,3,3]
>>> my_df.expect_column_distinct_values_to_contain_set(
    "my_col",
    [2,3]
)
{
"success": true
"result": {
    "observed_value": [1,2,3]
},
}
Parameters
  • column (str) – The column name.

  • value_set (set-like) – A set of objects used for comparison.

Keyword Arguments

parse_strings_as_datetimes (boolean or None) – If True values provided in value_set will be parsed as datetimes before making comparisons.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

expect_column_mean_to_be_between(self, column, min_value=None, max_value=None, strict_min=False, strict_max=False, result_format=None, include_config=True, catch_exceptions=None, meta=None)

Expect the column mean to be between a minimum value and a maximum value (inclusive).

expect_column_mean_to_be_between is a column_aggregate_expectation.

Parameters
  • column (str) – The column name.

  • min_value (float or None) – The minimum value for the column mean.

  • max_value (float or None) – The maximum value for the column mean.

  • strict_min (boolean) – If True, the column mean must be strictly larger than min_value, default=False

  • strict_max (boolean) – If True, the column mean must be strictly smaller than max_value, default=False

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

Notes

These fields in the result object are customized for this expectation:

{
    "observed_value": (float) The true mean for the column
}
  • min_value and max_value are both inclusive unless strict_min or strict_max are set to True.

  • If min_value is None, then max_value is treated as an upper bound.

  • If max_value is None, then min_value is treated as a lower bound.

expect_column_median_to_be_between(self, column, min_value=None, max_value=None, strict_min=False, strict_max=False, result_format=None, include_config=True, catch_exceptions=None, meta=None)

Expect the column median to be between a minimum value and a maximum value.

expect_column_median_to_be_between is a column_aggregate_expectation.

Parameters
  • column (str) – The column name.

  • min_value (int or None) – The minimum value for the column median.

  • max_value (int or None) – The maximum value for the column median.

  • strict_min (boolean) – If True, the column median must be strictly larger than min_value, default=False

  • strict_max (boolean) – If True, the column median must be strictly smaller than max_value, default=False

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

Notes

These fields in the result object are customized for this expectation:

{
    "observed_value": (float) The true median for the column
}
  • min_value and max_value are both inclusive unless strict_min or strict_max are set to True.

  • If min_value is None, then max_value is treated as an upper bound

  • If max_value is None, then min_value is treated as a lower bound

expect_column_quantile_values_to_be_between(self, column, quantile_ranges, allow_relative_error=False, result_format=None, include_config=True, catch_exceptions=None, meta=None)

Expect specific provided column quantiles to be between provided minimum and maximum values.

quantile_ranges must be a dictionary with two keys:

  • quantiles: (list of float) increasing ordered list of desired quantile values

  • value_ranges: (list of lists): Each element in this list consists of a list with two values, a lower and upper bound (inclusive) for the corresponding quantile.

For each provided range:

  • min_value and max_value are both inclusive.

  • If min_value is None, then max_value is treated as an upper bound only

  • If max_value is None, then min_value is treated as a lower bound only

The length of the quantiles list and quantile_values list must be equal.

For example:

# my_df.my_col = [1,2,2,3,3,3,4]
>>> my_df.expect_column_quantile_values_to_be_between(
    "my_col",
    {
        "quantiles": [0., 0.333, 0.6667, 1.],
        "value_ranges": [[0,1], [2,3], [3,4], [4,5]]
    }
)
{
  "success": True,
    "result": {
      "observed_value": {
        "quantiles: [0., 0.333, 0.6667, 1.],
        "values": [1, 2, 3, 4],
      }
      "element_count": 7,
      "missing_count": 0,
      "missing_percent": 0.0,
      "details": {
        "success_details": [true, true, true, true]
      }
    }
  }
}

expect_column_quantile_values_to_be_between can be computationally intensive for large datasets.

expect_column_quantile_values_to_be_between is a column_aggregate_expectation.

Parameters
  • column (str) – The column name.

  • quantile_ranges (dictionary) – Quantiles and associated value ranges for the column. See above for details.

  • allow_relative_error (boolean) – Whether to allow relative error in quantile communications on backends that support or require it.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

Notes

These fields in the result object are customized for this expectation: :: details.success_details

expect_column_stdev_to_be_between(self, column, min_value=None, max_value=None, strict_min=False, strict_max=False, result_format=None, include_config=True, catch_exceptions=None, meta=None)

Expect the column standard deviation to be between a minimum value and a maximum value. Uses sample standard deviation (normalized by N-1).

expect_column_stdev_to_be_between is a column_aggregate_expectation.

Parameters
  • column (str) – The column name.

  • min_value (float or None) – The minimum value for the column standard deviation.

  • max_value (float or None) – The maximum value for the column standard deviation.

  • strict_min (boolean) – If True, the column standard deviation must be strictly larger than min_value, default=False

  • strict_max (boolean) – If True, the column standard deviation must be strictly smaller than max_value, default=False

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

Notes

These fields in the result object are customized for this expectation:

{
    "observed_value": (float) The true standard deviation for the column
}
  • min_value and max_value are both inclusive unless strict_min or strict_max are set to True.

  • If min_value is None, then max_value is treated as an upper bound

  • If max_value is None, then min_value is treated as a lower bound

expect_column_unique_value_count_to_be_between(self, column, min_value=None, max_value=None, result_format=None, include_config=True, catch_exceptions=None, meta=None)

Expect the number of unique values to be between a minimum value and a maximum value.

expect_column_unique_value_count_to_be_between is a column_aggregate_expectation.

Parameters
  • column (str) – The column name.

  • min_value (int or None) – The minimum number of unique values allowed.

  • max_value (int or None) – The maximum number of unique values allowed.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

Notes

These fields in the result object are customized for this expectation:

{
    "observed_value": (int) The number of unique values in the column
}
  • min_value and max_value are both inclusive.

  • If min_value is None, then max_value is treated as an upper bound

  • If max_value is None, then min_value is treated as a lower bound

expect_column_proportion_of_unique_values_to_be_between(self, column, min_value=0, max_value=1, strict_min=False, strict_max=False, result_format=None, include_config=True, catch_exceptions=None, meta=None)

Expect the proportion of unique values to be between a minimum value and a maximum value.

For example, in a column containing [1, 2, 2, 3, 3, 3, 4, 4, 4, 4], there are 4 unique values and 10 total values for a proportion of 0.4.

expect_column_proportion_of_unique_values_to_be_between is a column_aggregate_expectation.

Parameters
  • column (str) – The column name.

  • min_value (float or None) – The minimum proportion of unique values. (Proportions are on the range 0 to 1)

  • max_value (float or None) – The maximum proportion of unique values. (Proportions are on the range 0 to 1)

  • strict_min (boolean) – If True, the minimum proportion of unique values must be strictly larger than min_value, default=False

  • strict_max (boolean) – If True, the maximum proportion of unique values must be strictly smaller than max_value, default=False

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

Notes

These fields in the result object are customized for this expectation:

{
    "observed_value": (float) The proportion of unique values in the column
}
  • min_value and max_value are both inclusive unless strict_min or strict_max are set to True.

  • If min_value is None, then max_value is treated as an upper bound

  • If max_value is None, then min_value is treated as a lower bound

expect_column_most_common_value_to_be_in_set(self, column, value_set, ties_okay=None, result_format=None, include_config=True, catch_exceptions=None, meta=None)

Expect the most common value to be within the designated value set

expect_column_most_common_value_to_be_in_set is a column_aggregate_expectation.

Parameters
  • column (str) – The column name

  • value_set (set-like) – A list of potential values to match

Keyword Arguments

ties_okay (boolean or None) – If True, then the expectation will still succeed if values outside the designated set are as common (but not more common) than designated values

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

Notes

These fields in the result object are customized for this expectation:

{
    "observed_value": (list) The most common values in the column
}

observed_value contains a list of the most common values. Often, this will just be a single element. But if there’s a tie for most common among multiple values, observed_value will contain a single copy of each most common value.

expect_column_sum_to_be_between(self, column, min_value=None, max_value=None, strict_min=False, strict_max=False, result_format=None, include_config=True, catch_exceptions=None, meta=None)

Expect the column to sum to be between an min and max value

expect_column_sum_to_be_between is a column_aggregate_expectation.

Parameters
  • column (str) – The column name

  • min_value (comparable type or None) – The minimal sum allowed.

  • max_value (comparable type or None) – The maximal sum allowed.

  • strict_min (boolean) – If True, the minimal sum must be strictly larger than min_value, default=False

  • strict_max (boolean) – If True, the maximal sum must be strictly smaller than max_value, default=False

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

Notes

These fields in the result object are customized for this expectation:

{
    "observed_value": (list) The actual column sum
}
  • min_value and max_value are both inclusive unless strict_min or strict_max are set to True.

  • If min_value is None, then max_value is treated as an upper bound

  • If max_value is None, then min_value is treated as a lower bound

expect_column_min_to_be_between(self, column, min_value=None, max_value=None, strict_min=False, strict_max=False, parse_strings_as_datetimes=False, output_strftime_format=None, result_format=None, include_config=True, catch_exceptions=None, meta=None)

Expect the column minimum to be between an min and max value

expect_column_min_to_be_between is a column_aggregate_expectation.

Parameters
  • column (str) – The column name

  • min_value (comparable type or None) – The minimal column minimum allowed.

  • max_value (comparable type or None) – The maximal column minimum allowed.

  • strict_min (boolean) – If True, the minimal column minimum must be strictly larger than min_value, default=False

  • strict_max (boolean) – If True, the maximal column minimum must be strictly smaller than max_value, default=False

Keyword Arguments
  • parse_strings_as_datetimes (Boolean or None) – If True, parse min_value, max_values, and all non-null column values to datetimes before making comparisons.

  • output_strftime_format (str or None) – A valid strfime format for datetime output. Only used if parse_strings_as_datetimes=True.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

Notes

These fields in the result object are customized for this expectation:

{
    "observed_value": (list) The actual column min
}
  • min_value and max_value are both inclusive unless strict_min or strict_max are set to True.

  • If min_value is None, then max_value is treated as an upper bound

  • If max_value is None, then min_value is treated as a lower bound

expect_column_max_to_be_between(self, column, min_value=None, max_value=None, strict_min=False, strict_max=False, parse_strings_as_datetimes=False, output_strftime_format=None, result_format=None, include_config=True, catch_exceptions=None, meta=None)

Expect the column max to be between an min and max value

expect_column_max_to_be_between is a column_aggregate_expectation.

Parameters
  • column (str) – The column name

  • min_value (comparable type or None) – The minimum number of unique values allowed.

  • max_value (comparable type or None) – The maximum number of unique values allowed.

Keyword Arguments
  • parse_strings_as_datetimes (Boolean or None) – If True, parse min_value, max_values, and all non-null column values to datetimes before making comparisons.

  • output_strftime_format (str or None) – A valid strfime format for datetime output. Only used if parse_strings_as_datetimes=True.

  • strict_min (boolean) – If True, the minimal column minimum must be strictly larger than min_value, default=False

  • strict_max (boolean) – If True, the maximal column minimum must be strictly smaller than max_value, default=False

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

Notes

These fields in the result object are customized for this expectation:

{
    "observed_value": (list) The actual column max
}
  • min_value and max_value are both inclusive unless strict_min or strict_max are set to True.

  • If min_value is None, then max_value is treated as an upper bound

  • If max_value is None, then min_value is treated as a lower bound

expect_column_chisquare_test_p_value_to_be_greater_than(self, column, partition_object=None, p=0.05, tail_weight_holdout=0, result_format=None, include_config=True, catch_exceptions=None, meta=None)

Expect column values to be distributed similarly to the provided categorical partition. This expectation compares categorical distributions using a Chi-squared test. It returns success=True if values in the column match the distribution of the provided partition.

expect_column_chisquare_test_p_value_to_be_greater_than is a column_aggregate_expectation.

Parameters
  • column (str) – The column name.

  • partition_object (dict) – The expected partition object (see Partition Objects).

  • p (float) – The p-value threshold for rejecting the null hypothesis of the Chi-Squared test. For values below the specified threshold, the expectation will return success=False, rejecting the null hypothesis that the distributions are the same. Defaults to 0.05.

Keyword Arguments

tail_weight_holdout (float between 0 and 1 or None) – The amount of weight to split uniformly between values observed in the data but not present in the provided partition. tail_weight_holdout provides a mechanism to make the test less strict by assigning positive weights to unknown values observed in the data that are not present in the partition.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

Notes

These fields in the result object are customized for this expectation:

{
    "observed_value": (float) The true p-value of the Chi-squared test
    "details": {
        "observed_partition" (dict):
            The partition observed in the data.
        "expected_partition" (dict):
            The partition expected from the data, after including tail_weight_holdout
    }
}
abstract expect_column_bootstrapped_ks_test_p_value_to_be_greater_than(self, column, partition_object=None, p=0.05, bootstrap_samples=None, bootstrap_sample_size=None, result_format=None, include_config=True, catch_exceptions=None, meta=None)

Expect column values to be distributed similarly to the provided continuous partition. This expectation compares continuous distributions using a bootstrapped Kolmogorov-Smirnov test. It returns success=True if values in the column match the distribution of the provided partition.

The expected cumulative density function (CDF) is constructed as a linear interpolation between the bins, using the provided weights. Consequently the test expects a piecewise uniform distribution using the bins from the provided partition object.

expect_column_bootstrapped_ks_test_p_value_to_be_greater_than is a column_aggregate_expectation.

Parameters
  • column (str) – The column name.

  • partition_object (dict) – The expected partition object (see Partition Objects).

  • p (float) – The p-value threshold for the Kolmogorov-Smirnov test. For values below the specified threshold the expectation will return success=False, rejecting the null hypothesis that the distributions are the same. Defaults to 0.05.

Keyword Arguments
  • bootstrap_samples (int) – The number bootstrap rounds. Defaults to 1000.

  • bootstrap_sample_size (int) – The number of samples to take from the column for each bootstrap. A larger sample will increase the specificity of the test. Defaults to 2 * len(partition_object[‘weights’])

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

Notes

These fields in the result object are customized for this expectation:

{
    "observed_value": (float) The true p-value of the KS test
    "details": {
        "bootstrap_samples": The number of bootstrap rounds used
        "bootstrap_sample_size": The number of samples taken from
            the column in each bootstrap round
        "observed_cdf": The cumulative density function observed
            in the data, a dict containing 'x' values and cdf_values
            (suitable for plotting)
        "expected_cdf" (dict):
            The cumulative density function expected based on the
            partition object, a dict containing 'x' values and
            cdf_values (suitable for plotting)
        "observed_partition" (dict):
            The partition observed on the data, using the provided
            bins but also expanding from min(column) to max(column)
        "expected_partition" (dict):
            The partition expected from the data. For KS test,
            this will always be the partition_object parameter
    }
}
expect_column_kl_divergence_to_be_less_than(self, column, partition_object=None, threshold=None, tail_weight_holdout=0, internal_weight_holdout=0, bucketize_data=True, result_format=None, include_config=True, catch_exceptions=None, meta=None)

Expect the Kulback-Leibler (KL) divergence (relative entropy) of the specified column with respect to the partition object to be lower than the provided threshold.

KL divergence compares two distributions. The higher the divergence value (relative entropy), the larger the difference between the two distributions. A relative entropy of zero indicates that the data are distributed identically, when binned according to the provided partition.

In many practical contexts, choosing a value between 0.5 and 1 will provide a useful test.

This expectation works on both categorical and continuous partitions. See notes below for details.

expect_column_kl_divergence_to_be_less_than is a column_aggregate_expectation.

Parameters
  • column (str) – The column name.

  • partition_object (dict) – The expected partition object (see Partition Objects).

  • threshold (float) – The maximum KL divergence to for which to return success=True. If KL divergence is larger than the provided threshold, the test will return success=False.

Keyword Arguments
  • internal_weight_holdout (float between 0 and 1 or None) – The amount of weight to split uniformly among zero-weighted partition bins. internal_weight_holdout provides a mechanisms to make the test less strict by assigning positive weights to values observed in the data for which the partition explicitly expected zero weight. With no internal_weight_holdout, any value observed in such a region will cause KL divergence to rise to +Infinity. Defaults to 0.

  • tail_weight_holdout (float between 0 and 1 or None) – The amount of weight to add to the tails of the histogram. Tail weight holdout is split evenly between (-Infinity, min(partition_object[‘bins’])) and (max(partition_object[‘bins’]), +Infinity). tail_weight_holdout provides a mechanism to make the test less strict by assigning positive weights to values observed in the data that are not present in the partition. With no tail_weight_holdout, any value observed outside the provided partition_object will cause KL divergence to rise to +Infinity. Defaults to 0.

  • bucketize_data (boolean) – If True, then continuous data will be bucketized before evaluation. Setting this parameter to false allows evaluation of KL divergence with a None partition object for profiling against discrete data.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

Notes

These fields in the result object are customized for this expectation:

{
  "observed_value": (float) The true KL divergence (relative entropy) or None if the value is                   calculated as infinity, -infinity, or NaN
  "details": {
    "observed_partition": (dict) The partition observed in the data
    "expected_partition": (dict) The partition against which the data were compared,
                            after applying specified weight holdouts.
  }
}

If the partition_object is categorical, this expectation will expect the values in column to also be categorical.

  • If the column includes values that are not present in the partition, the tail_weight_holdout will be equally split among those values, providing a mechanism to weaken the strictness of the expectation (otherwise, relative entropy would immediately go to infinity).

  • If the partition includes values that are not present in the column, the test will simply include zero weight for that value.

If the partition_object is continuous, this expectation will discretize the values in the column according to the bins specified in the partition_object, and apply the test to the resulting distribution.

  • The internal_weight_holdout and tail_weight_holdout parameters provide a mechanism to weaken the expectation, since an expected weight of zero would drive relative entropy to be infinite if any data are observed in that interval.

  • If internal_weight_holdout is specified, that value will be distributed equally among any intervals with weight zero in the partition_object.

  • If tail_weight_holdout is specified, that value will be appended to the tails of the bins ((-Infinity, min(bins)) and (max(bins), Infinity).

If relative entropy/kl divergence goes to infinity for any of the reasons mentioned above, the observed value will be set to None. This is because inf, -inf, Nan, are not json serializable and cause some json parsers to crash when encountered. The python None token will be serialized to null in json.

expect_column_pair_cramers_phi_value_to_be_less_than(self, column_A, column_B, bins_A=None, bins_B=None, n_bins_A=None, n_bins_B=None, threshold=0.1, result_format=None, include_config=True, catch_exceptions=None, meta=None)

Expect the values in column_A to be independent of those in column_B.

Parameters
  • column_A (str) – The first column name

  • column_B (str) – The second column name

  • threshold (float) – Maximum allowed value of cramers V for expectation to pass.

Keyword Arguments
  • bins_A (list of float) – Bins for column_A.

  • bins_B (list of float) – Bins for column_B.

  • n_bins_A (int) – Number of bins for column_A. Ignored if bins_A is not None.

  • n_bins_B (int) – Number of bins for column_B. Ignored if bins_B is not None.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

A JSON-serializable expectation result object.

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

abstract expect_column_pair_values_to_be_equal(self, column_A, column_B, ignore_row_if='both_values_are_missing', result_format=None, include_config=True, catch_exceptions=None, meta=None)

Expect the values in column A to be the same as column B.

Parameters
  • column_A (str) – The first column name

  • column_B (str) – The second column name

Keyword Arguments

ignore_row_if (str) – “both_values_are_missing”, “either_value_is_missing”, “neither”

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

abstract expect_column_pair_values_A_to_be_greater_than_B(self, column_A, column_B, or_equal=None, parse_strings_as_datetimes=False, allow_cross_type_comparisons=None, ignore_row_if='both_values_are_missing', result_format=None, include_config=True, catch_exceptions=None, meta=None)

Expect values in column A to be greater than column B.

Parameters
  • column_A (str) – The first column name

  • column_B (str) – The second column name

  • or_equal (boolean or None) – If True, then values can be equal, not strictly greater

Keyword Arguments
  • allow_cross_type_comparisons (boolean or None) – If True, allow comparisons between types (e.g. integer and string). Otherwise, attempting such comparisons will raise an exception.

  • ignore_row_if (str) – “both_values_are_missing”, “either_value_is_missing”, “neither

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

abstract expect_column_pair_values_to_be_in_set(self, column_A, column_B, value_pairs_set, ignore_row_if='both_values_are_missing', result_format=None, include_config=True, catch_exceptions=None, meta=None)

Expect paired values from columns A and B to belong to a set of valid pairs.

Parameters
  • column_A (str) – The first column name

  • column_B (str) – The second column name

  • value_pairs_set (list of tuples) – All the valid pairs to be matched

Keyword Arguments

ignore_row_if (str) – “both_values_are_missing”, “either_value_is_missing”, “never”

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

abstract expect_multicolumn_values_to_be_unique(self, column_list, ignore_row_if='all_values_are_missing', result_format=None, row_condition=None, condition_parser=None, include_config=True, catch_exceptions=None, meta=None)

NOTE: This method is deprecated. Please use expect_select_column_values_to_be_unique_within_record instead Expect the values for each record to be unique across the columns listed. Note that records can be duplicated.

For example:

A B C
1 1 2 Fail
1 2 3 Pass
8 2 7 Pass
1 2 3 Pass
4 4 4 Fail
Parameters

column_list (tuple or list) – The column names to evaluate

Keyword Arguments

ignore_row_if (str) – “all_values_are_missing”, “any_value_is_missing”, “never”

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

abstract expect_select_column_values_to_be_unique_within_record(self, column_list, ignore_row_if='all_values_are_missing', result_format=None, row_condition=None, condition_parser=None, include_config=True, catch_exceptions=None, meta=None)

Expect the values for each record to be unique across the columns listed. Note that records can be duplicated.

For example:

A B C
1 1 2 Fail
1 2 3 Pass
8 2 7 Pass
1 2 3 Pass
4 4 4 Fail
Parameters

column_list (tuple or list) – The column names to evaluate

Keyword Arguments

ignore_row_if (str) – “all_values_are_missing”, “any_value_is_missing”, “never”

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

abstract expect_compound_columns_to_be_unique(self, column_list, ignore_row_if='all_values_are_missing', result_format=None, row_condition=None, condition_parser=None, include_config=True, catch_exceptions=None, meta=None)

Expect that the columns are unique together, e.g. a multi-column primary key Note that all instances of any duplicates are considered failed

For example:

A B C
1 1 2 Fail
1 2 3 Pass
1 1 2 Fail
2 2 2 Pass
3 2 3 Pass
Parameters

column_list (tuple or list) – The column names to evaluate

Keyword Arguments

ignore_row_if (str) – “all_values_are_missing”, “any_value_is_missing”, “never”

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

abstract expect_multicolumn_sum_to_equal(self, column_list, sum_total, result_format=None, include_config=True, catch_exceptions=None, meta=None)

Multi-Column Map Expectation

Expects that sum of all rows for a set of columns is equal to a specific value

Parameters
  • column_list (List[str]) – Set of columns to be checked

  • sum_total (int) – expected sum of columns

static _parse_value_set(value_set)
attempt_allowing_relative_error(self)

Subclasses can override this method if the respective data source (e.g., Redshift) supports “approximate” mode. In certain cases (e.g., for SparkDFDataset), a fraction between 0 and 1 (i.e., not only a boolean) is allowed.

class great_expectations.dataset.MetaPandasDataset(*args, **kwargs)

Bases: great_expectations.dataset.dataset.Dataset

MetaPandasDataset is a thin layer between Dataset and PandasDataset.

This two-layer inheritance is required to make @classmethod decorators work.

Practically speaking, that means that MetaPandasDataset implements expectation decorators, like column_map_expectation and column_aggregate_expectation, and PandasDataset implements the expectation methods themselves.

classmethod column_map_expectation(cls, func)

Constructs an expectation using column-map semantics.

The MetaPandasDataset implementation replaces the “column” parameter supplied by the user with a pandas Series object containing the actual column from the relevant pandas dataframe. This simplifies the implementing expectation logic while preserving the standard Dataset signature and expected behavior.

See column_map_expectation for full documentation of this function.

classmethod column_pair_map_expectation(cls, func)

The column_pair_map_expectation decorator handles boilerplate issues surrounding the common pattern of evaluating truthiness of some condition on a per row basis across a pair of columns.

classmethod multicolumn_map_expectation(cls, func)

The multicolumn_map_expectation decorator handles boilerplate issues surrounding the common pattern of evaluating truthiness of some condition on a per row basis across a set of columns.

class great_expectations.dataset.PandasDataset(*args, **kwargs)

Bases: great_expectations.dataset.pandas_dataset.MetaPandasDataset, pandas.DataFrame

PandasDataset instantiates the great_expectations Expectations API as a subclass of a pandas.DataFrame.

For the full API reference, please see Dataset

Notes

  1. Samples and Subsets of PandaDataSet have ALL the expectations of the original data frame unless the user specifies the discard_subset_failing_expectations = True property on the original data frame.

  2. Concatenations, joins, and merges of PandaDataSets contain NO expectations (since no autoinspection is performed by default).

Feature Maturity

icon-64f5c1aed45a11ebbc9c0242ac110002 Validation Engine - Pandas - How-to Guide
Use Pandas DataFrame to validate data
Maturity: Production
Details:
API Stability: Stable
Implementation Completeness: Complete
Unit Test Coverage: Complete
Integration Infrastructure/Test Coverage: N/A -> see relevant Datasource evaluation
Documentation Completeness: Complete
Bug Risk: Low
Expectation Completeness: Complete
_internal_names
_internal_names_set
_supports_row_condition = True
property _constructor(self)

Used when a manipulation result has the same dimensions as the original.

__finalize__(self, other, method=None, **kwargs)

Propagate metadata from other to self.

Parameters
  • other (the object from which to get the attributes that we are going) – to propagate

  • method (optional, a passed method name ; possibly to take different) – types of propagation actions based on this

_apply_row_condition(self, row_condition, condition_parser)
get_row_count(self)

Returns: int, table row count

get_column_count(self)

Returns: int, table column count

get_table_columns(self)

Returns: List[str], list of column names

get_column_sum(self, column)

Returns: float

get_column_max(self, column, parse_strings_as_datetimes=False)

Returns: Any

get_column_min(self, column, parse_strings_as_datetimes=False)

Returns: Any

get_column_mean(self, column)

Returns: float

get_column_nonnull_count(self, column)

Returns: int

get_column_value_counts(self, column, sort='value', collate=None)

Get a series containing the frequency counts of unique values from the named column.

Parameters
  • column – the column for which to obtain value_counts

  • sort (string) – must be one of “value”, “count”, or “none”. - if “value” then values in the resulting partition object will be sorted lexigraphically - if “count” then values will be sorted according to descending count (frequency) - if “none” then values will not be sorted

  • collate (string) – the collate (sort) method to be used on supported backends (SqlAlchemy only)

Returns

pd.Series of value counts for a column, sorted according to the value requested in sort

get_column_unique_count(self, column)

Returns: int

get_column_modes(self, column)

Returns: List[Any], list of modes (ties OK)

get_column_median(self, column)

Returns: Any

get_column_quantiles(self, column, quantiles, allow_relative_error=False)

Get the values in column closest to the requested quantiles :param column: name of column :type column: string :param quantiles: the quantiles to return. quantiles must be a tuple to ensure caching is possible :type quantiles: tuple of float

Returns

the nearest values in the dataset to those quantiles

Return type

List[Any]

get_column_stdev(self, column)

Returns: float

get_column_hist(self, column, bins)

Get a histogram of column values :param column: the column for which to generate the histogram :param bins: the bins to slice the histogram. bins must be a tuple to ensure caching is possible :type bins: tuple

Returns: List[int], a list of counts corresponding to bins

get_column_count_in_range(self, column, min_val=None, max_val=None, strict_min=False, strict_max=True)

Returns: int

get_crosstab(self, column_A, column_B, bins_A=None, bins_B=None, n_bins_A=None, n_bins_B=None)

Get crosstab of column_A and column_B, binning values if necessary

get_binned_values(self, series, bins, n_bins)

Get binned values of series.

Parameters
  • Series (pd.Series) – Input series

  • bins (list) – Bins for the series. List of numeric if series is numeric or list of list of series values else.

  • n_bins (int) – Number of bins. Ignored if bins is not None.

expect_column_values_to_be_unique(self, column, mostly=None, result_format=None, row_condition=None, condition_parser=None, include_config=True, catch_exceptions=None, meta=None)

Expect each column value to be unique.

This expectation detects duplicates. All duplicated values are counted as exceptions.

For example, [1, 2, 3, 3, 3] will return [3, 3, 3] in result.exceptions_list, with unexpected_percent = 60.0.

expect_column_values_to_be_unique is a column_map_expectation.

Parameters

column (str) – The column name.

Keyword Arguments

mostly (None or a float between 0 and 1) – Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

expect_column_values_to_not_be_null(self, column, mostly=None, result_format=None, row_condition=None, condition_parser=None, include_config=True, catch_exceptions=None, meta=None, include_nulls=True)

Expect column values to not be null.

To be counted as an exception, values must be explicitly null or missing, such as a NULL in PostgreSQL or an np.NaN in pandas. Empty strings don’t count as null unless they have been coerced to a null type.

expect_column_values_to_not_be_null is a column_map_expectation.

Parameters

column (str) – The column name.

Keyword Arguments

mostly (None or a float between 0 and 1) – Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

expect_column_values_to_be_null(self, column, mostly=None, result_format=None, row_condition=None, condition_parser=None, include_config=True, catch_exceptions=None, meta=None)

Expect column values to be null.

expect_column_values_to_be_null is a column_map_expectation.

Parameters

column (str) – The column name.

Keyword Arguments

mostly (None or a float between 0 and 1) – Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

expect_column_values_to_be_of_type(self, column, type_, **kwargs)

The pandas implementation of this expectation takes kwargs mostly, result_format, include_config, catch_exceptions, and meta as other expectations, however it declares **kwargs because it needs to be able to fork into either aggregate or map semantics depending on the column type (see below).

In Pandas, columns may be typed, or they may be of the generic “object” type which can include rows with different storage types in the same column.

To respect that implementation, the expect_column_values_to_be_of_type expectations will first attempt to use the column dtype information to determine whether the column is restricted to the provided type. If that is possible, then expect_column_values_to_be_of_type will return aggregate information including an observed_value, similarly to other backends.

If it is not possible (because the column dtype is “object” but a more specific type was specified), then PandasDataset will use column map semantics: it will return map expectation results and check each value individually, which can be substantially slower.

Unfortunately, the “object” type is also used to contain any string-type columns (including ‘str’ and numpy ‘string_’ (bytes)); consequently, it is not possible to test for string columns using aggregate semantics.

_expect_column_values_to_be_of_type__aggregate(self, column, type_, mostly=None, result_format=None, row_condition=None, condition_parser=None, include_config=True, catch_exceptions=None, meta=None)
static _native_type_type_map(type_)
_expect_column_values_to_be_of_type__map(self, column, type_, mostly=None, result_format=None, row_condition=None, condition_parser=None, include_config=True, catch_exceptions=None, meta=None)
expect_column_values_to_be_in_type_list(self, column, type_list, **kwargs)

The pandas implementation of this expectation takes kwargs mostly, result_format, include_config, catch_exceptions, and meta as other expectations, however it declares **kwargs because it needs to be able to fork into either aggregate or map semantics depending on the column type (see below).

In Pandas, columns may be typed, or they may be of the generic “object” type which can include rows with different storage types in the same column.

To respect that implementation, the expect_column_values_to_be_of_type expectations will first attempt to use the column dtype information to determine whether the column is restricted to the provided type. If that is possible, then expect_column_values_to_be_of_type will return aggregate information including an observed_value, similarly to other backends.

If it is not possible (because the column dtype is “object” but a more specific type was specified), then PandasDataset will use column map semantics: it will return map expectation results and check each value individually, which can be substantially slower.

Unfortunately, the “object” type is also used to contain any string-type columns (including ‘str’ and numpy ‘string_’ (bytes)); consequently, it is not possible to test for string columns using aggregate semantics.

_expect_column_values_to_be_in_type_list__aggregate(self, column, type_list, mostly=None, result_format=None, row_condition=None, condition_parser=None, include_config=True, catch_exceptions=None, meta=None)
_expect_column_values_to_be_in_type_list__map(self, column, type_list, mostly=None, result_format=None, row_condition=None, condition_parser=None, include_config=True, catch_exceptions=None, meta=None)
expect_column_values_to_be_in_set(self, column, value_set, mostly=None, parse_strings_as_datetimes=None, result_format=None, row_condition=None, condition_parser=None, include_config=True, catch_exceptions=None, meta=None)

Expect each column value to be in a given set.

For example:

# my_df.my_col = [1,2,2,3,3,3]
>>> my_df.expect_column_values_to_be_in_set(
    "my_col",
    [2,3]
)
{
  "success": false
  "result": {
    "unexpected_count": 1
    "unexpected_percent": 16.66666666666666666,
    "unexpected_percent_nonmissing": 16.66666666666666666,
    "partial_unexpected_list": [
      1
    ],
  },
}

expect_column_values_to_be_in_set is a column_map_expectation.

Parameters
  • column (str) – The column name.

  • value_set (set-like) – A set of objects used for comparison.

Keyword Arguments
  • mostly (None or a float between 0 and 1) – Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly.

  • parse_strings_as_datetimes (boolean or None) – If True values provided in value_set will be parsed as datetimes before making comparisons.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

expect_column_values_to_not_be_in_set(self, column, value_set, mostly=None, parse_strings_as_datetimes=None, result_format=None, row_condition=None, condition_parser=None, include_config=True, catch_exceptions=None, meta=None)

Expect column entries to not be in the set.

For example:

# my_df.my_col = [1,2,2,3,3,3]
>>> my_df.expect_column_values_to_not_be_in_set(
    "my_col",
    [1,2]
)
{
  "success": false
  "result": {
    "unexpected_count": 3
    "unexpected_percent": 50.0,
    "unexpected_percent_nonmissing": 50.0,
    "partial_unexpected_list": [
      1, 2, 2
    ],
  },
}

expect_column_values_to_not_be_in_set is a column_map_expectation.

Parameters
  • column (str) – The column name.

  • value_set (set-like) – A set of objects used for comparison.

Keyword Arguments

mostly (None or a float between 0 and 1) – Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

expect_column_values_to_be_between(self, column, min_value=None, max_value=None, strict_min=False, strict_max=False, parse_strings_as_datetimes=None, output_strftime_format=None, allow_cross_type_comparisons=None, mostly=None, row_condition=None, condition_parser=None, result_format=None, include_config=True, catch_exceptions=None, meta=None)

Expect column entries to be between a minimum value and a maximum value (inclusive).

expect_column_values_to_be_between is a column_map_expectation.

Parameters
  • column (str) – The column name.

  • min_value (comparable type or None) – The minimum value for a column entry.

  • max_value (comparable type or None) – The maximum value for a column entry.

Keyword Arguments
  • strict_min (boolean) – If True, values must be strictly larger than min_value, default=False

  • strict_max (boolean) – If True, values must be strictly smaller than max_value, default=False allow_cross_type_comparisons (boolean or None) : If True, allow comparisons between types (e.g. integer and string). Otherwise, attempting such comparisons will raise an exception.

  • parse_strings_as_datetimes (boolean or None) – If True, parse min_value, max_value, and all non-null column values to datetimes before making comparisons.

  • output_strftime_format (str or None) – A valid strfime format for datetime output. Only used if parse_strings_as_datetimes=True.

  • mostly (None or a float between 0 and 1) – Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

Notes

  • min_value and max_value are both inclusive unless strict_min or strict_max are set to True.

  • If min_value is None, then max_value is treated as an upper bound, and there is no minimum value checked.

  • If max_value is None, then min_value is treated as a lower bound, and there is no maximum value checked.

expect_column_values_to_be_increasing(self, column, strictly=None, parse_strings_as_datetimes=None, output_strftime_format=None, mostly=None, row_condition=None, condition_parser=None, result_format=None, include_config=True, catch_exceptions=None, meta=None)

Expect column values to be increasing.

By default, this expectation only works for numeric or datetime data. When parse_strings_as_datetimes=True, it can also parse strings to datetimes.

If strictly=True, then this expectation is only satisfied if each consecutive value is strictly increasing–equal values are treated as failures.

expect_column_values_to_be_increasing is a column_map_expectation.

Parameters

column (str) – The column name.

Keyword Arguments
  • strictly (Boolean or None) – If True, values must be strictly greater than previous values

  • parse_strings_as_datetimes (boolean or None) – If True, all non-null column values to datetimes before making comparisons

  • mostly (None or a float between 0 and 1) – Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

expect_column_values_to_be_decreasing(self, column, strictly=None, parse_strings_as_datetimes=None, output_strftime_format=None, mostly=None, row_condition=None, condition_parser=None, result_format=None, include_config=True, catch_exceptions=None, meta=None)

Expect column values to be decreasing.

By default, this expectation only works for numeric or datetime data. When parse_strings_as_datetimes=True, it can also parse strings to datetimes.

If strictly=True, then this expectation is only satisfied if each consecutive value is strictly decreasing–equal values are treated as failures.

expect_column_values_to_be_decreasing is a column_map_expectation.

Parameters

column (str) – The column name.

Keyword Arguments
  • strictly (Boolean or None) – If True, values must be strictly greater than previous values

  • parse_strings_as_datetimes (boolean or None) – If True, all non-null column values to datetimes before making comparisons

  • mostly (None or a float between 0 and 1) – Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

expect_column_value_lengths_to_be_between(self, column, min_value=None, max_value=None, mostly=None, row_condition=None, condition_parser=None, result_format=None, include_config=True, catch_exceptions=None, meta=None)

Expect column entries to be strings with length between a minimum value and a maximum value (inclusive).

This expectation only works for string-type values. Invoking it on ints or floats will raise a TypeError.

expect_column_value_lengths_to_be_between is a column_map_expectation.

Parameters

column (str) – The column name.

Keyword Arguments
  • min_value (int or None) – The minimum value for a column entry length.

  • max_value (int or None) – The maximum value for a column entry length.

  • mostly (None or a float between 0 and 1) – Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

Notes

  • min_value and max_value are both inclusive.

  • If min_value is None, then max_value is treated as an upper bound, and the number of acceptable rows has no minimum.

  • If max_value is None, then min_value is treated as a lower bound, and the number of acceptable rows has no maximum.

expect_column_value_lengths_to_equal(self, column, value, mostly=None, result_format=None, row_condition=None, condition_parser=None, include_config=True, catch_exceptions=None, meta=None)

Expect column entries to be strings with length equal to the provided value.

This expectation only works for string-type values. Invoking it on ints or floats will raise a TypeError.

expect_column_values_to_be_between is a column_map_expectation.

Parameters
  • column (str) – The column name.

  • value (int or None) – The expected value for a column entry length.

Keyword Arguments

mostly (None or a float between 0 and 1) – Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

expect_column_values_to_match_regex(self, column, regex, mostly=None, result_format=None, row_condition=None, condition_parser=None, include_config=True, catch_exceptions=None, meta=None)

Expect column entries to be strings that match a given regular expression. Valid matches can be found anywhere in the string, for example “[at]+” will identify the following strings as expected: “cat”, “hat”, “aa”, “a”, and “t”, and the following strings as unexpected: “fish”, “dog”.

expect_column_values_to_match_regex is a column_map_expectation.

Parameters
  • column (str) – The column name.

  • regex (str) – The regular expression the column entries should match.

Keyword Arguments

mostly (None or a float between 0 and 1) – Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

expect_column_values_to_not_match_regex(self, column, regex, mostly=None, result_format=None, row_condition=None, condition_parser=None, include_config=True, catch_exceptions=None, meta=None)

Expect column entries to be strings that do NOT match a given regular expression. The regex must not match any portion of the provided string. For example, “[at]+” would identify the following strings as expected: “fish”, “dog”, and the following as unexpected: “cat”, “hat”.

expect_column_values_to_not_match_regex is a column_map_expectation.

Parameters
  • column (str) – The column name.

  • regex (str) – The regular expression the column entries should NOT match.

Keyword Arguments

mostly (None or a float between 0 and 1) – Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

expect_column_values_to_match_regex_list(self, column, regex_list, match_on='any', mostly=None, result_format=None, row_condition=None, condition_parser=None, include_config=True, catch_exceptions=None, meta=None)

Expect the column entries to be strings that can be matched to either any of or all of a list of regular expressions. Matches can be anywhere in the string.

expect_column_values_to_match_regex_list is a column_map_expectation.

Parameters
  • column (str) – The column name.

  • regex_list (list) – The list of regular expressions which the column entries should match

Keyword Arguments
  • match_on= (string) – “any” or “all”. Use “any” if the value should match at least one regular expression in the list. Use “all” if it should match each regular expression in the list.

  • mostly (None or a float between 0 and 1) – Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

expect_column_values_to_not_match_regex_list(self, column, regex_list, mostly=None, result_format=None, row_condition=None, condition_parser=None, include_config=True, catch_exceptions=None, meta=None)

Expect the column entries to be strings that do not match any of a list of regular expressions. Matches can be anywhere in the string.

expect_column_values_to_not_match_regex_list is a column_map_expectation.

Parameters
  • column (str) – The column name.

  • regex_list (list) – The list of regular expressions which the column entries should not match

Keyword Arguments

mostly (None or a float between 0 and 1) – Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

expect_column_values_to_match_strftime_format(self, column, strftime_format, mostly=None, result_format=None, row_condition=None, condition_parser=None, include_config=True, catch_exceptions=None, meta=None)

Expect column entries to be strings representing a date or time with a given format.

expect_column_values_to_match_strftime_format is a column_map_expectation.

Parameters
  • column (str) – The column name.

  • strftime_format (str) – A strftime format string to use for matching

Keyword Arguments

mostly (None or a float between 0 and 1) – Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

expect_column_values_to_be_dateutil_parseable(self, column, mostly=None, result_format=None, row_condition=None, condition_parser=None, include_config=True, catch_exceptions=None, meta=None)

Expect column entries to be parsable using dateutil.

expect_column_values_to_be_dateutil_parseable is a column_map_expectation.

Parameters

column (str) – The column name.

Keyword Arguments

mostly (None or a float between 0 and 1) – Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

expect_column_values_to_be_json_parseable(self, column, mostly=None, result_format=None, row_condition=None, condition_parser=None, include_config=True, catch_exceptions=None, meta=None)

Expect column entries to be data written in JavaScript Object Notation.

expect_column_values_to_be_json_parseable is a column_map_expectation.

Parameters

column (str) – The column name.

Keyword Arguments

mostly (None or a float between 0 and 1) – Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

expect_column_values_to_match_json_schema(self, column, json_schema, mostly=None, result_format=None, row_condition=None, condition_parser=None, include_config=True, catch_exceptions=None, meta=None)

Expect column entries to be JSON objects matching a given JSON schema.

expect_column_values_to_match_json_schema is a column_map_expectation.

Parameters

column (str) – The column name.

Keyword Arguments

mostly (None or a float between 0 and 1) – Return “success”: True if at least mostly fraction of values match the expectation. For more detail, see mostly.

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

expect_column_parameterized_distribution_ks_test_p_value_to_be_greater_than(self, column, distribution, p_value=0.05, params=None, result_format=None, row_condition=None, condition_parser=None, include_config=True, catch_exceptions=None, meta=None)

Expect the column values to be distributed similarly to a scipy distribution. This expectation compares the provided column to the specified continuous distribution with a parametric Kolmogorov-Smirnov test. The K-S test compares the provided column to the cumulative density function (CDF) of the specified scipy distribution. If you don’t know the desired distribution shape parameters, use the ge.dataset.util.infer_distribution_parameters() utility function to estimate them.

It returns ‘success’=True if the p-value from the K-S test is greater than or equal to the provided p-value.

expect_column_parameterized_distribution_ks_test_p_value_to_be_greater_than is a column_aggregate_expectation.

Parameters
  • column (str) – The column name.

  • distribution (str) –

    The scipy distribution name. See: https://docs.scipy.org/doc/scipy/reference/stats.html Currently supported distributions are listed in the Notes section below.

  • p_value (float) – The threshold p-value for a passing test. Default is 0.05.

  • params (dict or list) –

    A dictionary or positional list of shape parameters that describe the distribution you want to test the data against. Include key values specific to the distribution from the appropriate scipy distribution CDF function. ‘loc’ and ‘scale’ are used as translational parameters. See https://docs.scipy.org/doc/scipy/reference/stats.html#continuous-distributions

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

Notes

These fields in the result object are customized for this expectation:

{
    "details":
        "expected_params" (dict): The specified or inferred parameters of the distribution to test                         against
        "ks_results" (dict): The raw result of stats.kstest()
}
  • The Kolmogorov-Smirnov test’s null hypothesis is that the column is similar to the provided distribution.

  • Supported scipy distributions:

    • norm

    • beta

    • gamma

    • uniform

    • chi2

    • expon

expect_column_bootstrapped_ks_test_p_value_to_be_greater_than(self, column, partition_object=None, p=0.05, bootstrap_samples=None, bootstrap_sample_size=None, result_format=None, row_condition=None, condition_parser=None, include_config=True, catch_exceptions=None, meta=None)

Expect column values to be distributed similarly to the provided continuous partition. This expectation compares continuous distributions using a bootstrapped Kolmogorov-Smirnov test. It returns success=True if values in the column match the distribution of the provided partition.

The expected cumulative density function (CDF) is constructed as a linear interpolation between the bins, using the provided weights. Consequently the test expects a piecewise uniform distribution using the bins from the provided partition object.

expect_column_bootstrapped_ks_test_p_value_to_be_greater_than is a column_aggregate_expectation.

Parameters
  • column (str) – The column name.

  • partition_object (dict) – The expected partition object (see Partition Objects).

  • p (float) – The p-value threshold for the Kolmogorov-Smirnov test. For values below the specified threshold the expectation will return success=False, rejecting the null hypothesis that the distributions are the same. Defaults to 0.05.

Keyword Arguments
  • bootstrap_samples (int) – The number bootstrap rounds. Defaults to 1000.

  • bootstrap_sample_size (int) – The number of samples to take from the column for each bootstrap. A larger sample will increase the specificity of the test. Defaults to 2 * len(partition_object[‘weights’])

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

Notes

These fields in the result object are customized for this expectation:

{
    "observed_value": (float) The true p-value of the KS test
    "details": {
        "bootstrap_samples": The number of bootstrap rounds used
        "bootstrap_sample_size": The number of samples taken from
            the column in each bootstrap round
        "observed_cdf": The cumulative density function observed
            in the data, a dict containing 'x' values and cdf_values
            (suitable for plotting)
        "expected_cdf" (dict):
            The cumulative density function expected based on the
            partition object, a dict containing 'x' values and
            cdf_values (suitable for plotting)
        "observed_partition" (dict):
            The partition observed on the data, using the provided
            bins but also expanding from min(column) to max(column)
        "expected_partition" (dict):
            The partition expected from the data. For KS test,
            this will always be the partition_object parameter
    }
}
expect_column_pair_values_to_be_equal(self, column_A, column_B, ignore_row_if='both_values_are_missing', result_format=None, row_condition=None, condition_parser=None, include_config=True, catch_exceptions=None, meta=None)

Expect the values in column A to be the same as column B.

Parameters
  • column_A (str) – The first column name

  • column_B (str) – The second column name

Keyword Arguments

ignore_row_if (str) – “both_values_are_missing”, “either_value_is_missing”, “neither”

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

expect_column_pair_values_A_to_be_greater_than_B(self, column_A, column_B, or_equal=None, parse_strings_as_datetimes=None, allow_cross_type_comparisons=None, ignore_row_if='both_values_are_missing', result_format=None, row_condition=None, condition_parser=None, include_config=True, catch_exceptions=None, meta=None)

Expect values in column A to be greater than column B.

Parameters
  • column_A (str) – The first column name

  • column_B (str) – The second column name

  • or_equal (boolean or None) – If True, then values can be equal, not strictly greater

Keyword Arguments
  • allow_cross_type_comparisons (boolean or None) – If True, allow comparisons between types (e.g. integer and string). Otherwise, attempting such comparisons will raise an exception.

  • ignore_row_if (str) – “both_values_are_missing”, “either_value_is_missing”, “neither

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

expect_column_pair_values_to_be_in_set(self, column_A, column_B, value_pairs_set, ignore_row_if='both_values_are_missing', result_format=None, row_condition=None, condition_parser=None, include_config=True, catch_exceptions=None, meta=None)

Expect paired values from columns A and B to belong to a set of valid pairs.

Parameters
  • column_A (str) – The first column name

  • column_B (str) – The second column name

  • value_pairs_set (list of tuples) – All the valid pairs to be matched

Keyword Arguments

ignore_row_if (str) – “both_values_are_missing”, “either_value_is_missing”, “never”

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

expect_multicolumn_values_to_be_unique(self, column_list, mostly=None, ignore_row_if='all_values_are_missing', result_format=None, include_config=True, catch_exceptions=None, meta=None)

NOTE: This method is deprecated. Please use expect_select_column_values_to_be_unique_within_record instead Expect the values for each record to be unique across the columns listed. Note that records can be duplicated.

For example:

A B C
1 1 2 Fail
1 2 3 Pass
8 2 7 Pass
1 2 3 Pass
4 4 4 Fail
Parameters

column_list (tuple or list) – The column names to evaluate

Keyword Arguments

ignore_row_if (str) – “all_values_are_missing”, “any_value_is_missing”, “never”

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

expect_select_column_values_to_be_unique_within_record(self, column_list, mostly=None, ignore_row_if='all_values_are_missing', result_format=None, include_config=True, catch_exceptions=None, meta=None)

Expect the values for each record to be unique across the columns listed. Note that records can be duplicated.

For example:

A B C
1 1 2 Fail
1 2 3 Pass
8 2 7 Pass
1 2 3 Pass
4 4 4 Fail
Parameters

column_list (tuple or list) – The column names to evaluate

Keyword Arguments

ignore_row_if (str) – “all_values_are_missing”, “any_value_is_missing”, “never”

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

expect_multicolumn_sum_to_equal(self, column_list, sum_total, result_format=None, include_config=True, catch_exceptions=None, meta=None)

Multi-Column Map Expectation

Expects that sum of all rows for a set of columns is equal to a specific value

Parameters
  • column_list (List[str]) – Set of columns to be checked

  • sum_total (int) – expected sum of columns

expect_compound_columns_to_be_unique(self, column_list, mostly=None, ignore_row_if='all_values_are_missing', result_format=None, include_config=True, catch_exceptions=None, meta=None)

Expect that the columns are unique together, e.g. a multi-column primary key Note that all instances of any duplicates are considered failed

For example:

A B C
1 1 2 Fail
1 2 3 Pass
1 1 2 Fail
2 2 2 Pass
3 2 3 Pass
Parameters

column_list (tuple or list) – The column names to evaluate

Keyword Arguments

ignore_row_if (str) – “all_values_are_missing”, “any_value_is_missing”, “never”

Other Parameters
  • result_format (str or None) – Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. For more detail, see result_format.

  • include_config (boolean) – If True, then include the expectation config as part of the result object. For more detail, see include_config.

  • catch_exceptions (boolean or None) – If True, then catch exceptions and include them as part of the result object. For more detail, see catch_exceptions.

  • meta (dict or None) – A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see meta.

Returns

An ExpectationSuiteValidationResult

Exact fields vary depending on the values passed to result_format and include_config, catch_exceptions, and meta.

great_expectations.dataset.logger