एग्रीगेट-लेवल Expectations स्थापित करें
अब कॉलम-विशिष्ट Expectations को एग्रीगेट स्तर पर लिखने का अभ्यास करने का समय है। Expectation Suite और Batch पहले से ही क्रमशः suite और batch वैरिएबल्स को असाइन किए गए हैं, और Shein Footwear डेटासेट के साथ लोड किए गए हैं। Great Expectations और pandas क्रमशः gx और pd के रूप में उपलब्ध हैं।
यह अभ्यास पाठ्यक्रम का हिस्सा है
Great Expectations के साथ Data Quality परिचय
इंटरैक्टिव व्यावहारिक अभ्यास
इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।
# "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=____
)