开始使用免费开始使用

建立聚合层级的 Expectations

现在来练习在聚合层级编写一些列级 Expectations。Expectation Suite 和 Batch 分别已赋给变量 suitebatch,并已加载 Shein Footwear 数据集。Great Expectations 和 pandas 分别可用作 gxpd

本练习是课程的一部分

使用 Great Expectations 的数据质量入门

查看课程

交互式实操练习

通过完成这段示例代码来试试这个练习。

# "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=____
)
编辑并运行代码