Skip to content

Missing unexpected_index_column_names in validation result for expectation: ExpectColumnValuesToNotBeNull #11468

@CNysb

Description

@CNysb

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
when validating dataset with expectations ExpectColumnValuesToNotBeNull , validation result would not contain unexpected_index_column_names

Describe the solution you'd like
add param unexpected_index_column_names in _format_map_output method for ExpectColumnValuesToNotBeNull.class

Describe alternatives you've considered
not alternatives

Additional context

import great_expectations as gx
import pandas as pd
from pprint import pprint
data = pd.DataFrame({
"age": [25, 30, 35, 40, 45],
"customer_id": [1001, 1002, 1003, 1004, 1005],
"name": ["Alice", "Bob", "Charlie", "David", "Eva"],
"email": ["[email protected]", "[email protected]", "[email protected]", "[email protected]", None]
})
context = gx.get_context()
data_source = context.data_sources.add_pandas("test_pandas_source")
data_asset = data_source.add_dataframe_asset("test_pandas_df")
suite_name = "test_suite"
suite = gx.ExpectationSuite(name=suite_name)
suite = context.suites.add(suite)
exp_not_null = gx.expectations.ExpectColumnValuesToNotBeNull(column="email")
exp_value_between = gx.expectations.ExpectColumnValuesToBeBetween(column="age", min_value=1001, max_value=1004)
suite.add_expectation(exp_not_null)
suite.add_expectation(exp_value_between)

batch_definition = data_asset.add_batch_definition_whole_dataframe("test_batch")
validation_def = gx.ValidationDefinition(
data=batch_definition,
suite=suite,
name="test_validation"
)

val_result = validation_def.run(
batch_parameters={"dataframe": data},
result_format={"result_format": "COMPLETE", "unexpected_index_column_names": ["customer_id"]}
)

pprint(val_result)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions