LoslegenKostenlos loslegen

Establish aggregate-level Expectations

Time to practice writing some column-specific Expectations at the aggregate level. The Expectation Suite and Batch have already been assigned to the variables suite and batch, respectively, and loaded with the Shein Footwear dataset. Great Expectations and pandas are available as gx and pd, respectively.

Diese Übung ist Teil des Kurses

Introduction to Data Quality with Great Expectations

Kurs anzeigen

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# "colour" should be in the set "Khaki", "Purple", or "Grey"
colour_expectation = gx.expectations.ExpectColumnDistinctValuesToBeInSet(
    ____="colour", value_set={"Khaki", "Purple", "Grey"}
)

# "seller_name" should have 7 to 10 distinct values
seller_expectation = gx.expectations.ExpectColumnUniqueValueCountToBeBetween(
    column="seller_name", ____=7, ____=10
)

# "link" should have all unique values
link_expectation = gx.expectations.____(
    column="link"
)

# "review_count" should have a most common value in the set "0" or "100+"
review_count_expectation = gx.expectations.ExpectColumnMostCommonValueToBeInSet(
    column=____, value_set=____
)
Code bearbeiten und ausführen