始める無料で始める

集計レベルのExpectationを設定する

列に対する集計レベルのExpectationをいくつか書いて練習しましょう。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=____
)
コードを編集して実行