開始使用免費開始

建立彙總層級的 Expectations

來練習撰寫一些欄位層級、以彙總為單位的 Expectations。suitebatch 兩個變數已分別指派為 Expectation Suite 與 Batch,並載入 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=____
)
編輯並執行程式碼