Establish a Column Range Expectation
In this exercise, you'll be writing an Expectation regarding the column count of the Renewable Power Generation dataset. Suppose the number of columns can change, but it should always stay in an interval around 16.
The Renewable Power Generation dataset has already been loaded into a Batch, assigned to the variable batch
. Great Expectations and pandas are available as gx
and pd
, respectively.
This exercise is part of the course
Introduction to Data Quality with Great Expectations
Exercise instructions
- Write an Expectation that the column count of the dataset should be around 16, plus or minus 2.
- Validate your Expectation.
- Print out the success status of the Expectation, as well as the actual column count.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Create the Expectation
col_count_expectation = gx.expectations.____(
min_value=____, ____=____
)
# Validate the Expectation
validation_results = batch.____(
expect=____
)
# Print out the success status
print(____.____)
# Print out the actual column count
print(____.____)