基础列期望

使用 Great Expectations 的数据质量入门

Davina Moossazadeh

Data Scientist

Shein 鞋类数据集

Kaggle 的 Shein 鞋类数据集前五行,已加载到 pandas。DataFrame 包含以下列:"name"、"link"、"price_usd"、"mark_price_usd"、"star_rating"、"colour"、"seller_name"、"review_count"、"sku_id"和"hero_image"。

1 https://www.kaggle.com/datasets/atharvataras/shein-footwear-dataset
使用 Great Expectations 的数据质量入门

行级期望

  • 行级期望独立应用于每一行
    • 仅当每行都满足条件时才通过
使用 Great Expectations 的数据质量入门

行级期望

缺失值期望

gx.expectations.ExpectColumnValuesToNotBeNull(
    column="colour"
)

类型期望

gx.expectations.ExpectColumnValuesToBeOfType(
    column="review_count", type_="str"
)
使用 Great Expectations 的数据质量入门

聚合级期望:去重值

去重值期望

gx.expectations.ExpectColumnDistinctValuesToEqualSet(
    column="seller_name", value_set={"Womens Shoes"}
)
使用 Great Expectations 的数据质量入门

聚合级期望:唯一值计数

唯一值计数期望

gx.expectations.ExpectColumnUniqueValueCountToBeBetween(
    column="review_count", min_value=5, max_value=101
)
使用 Great Expectations 的数据质量入门

聚合级期望:唯一性

唯一性期望

gx.expectations.ExpectColumnValuesToBeUnique(
    column="sku_id"
)
使用 Great Expectations 的数据质量入门

聚合级期望:众数

众数期望

gx.expectations.ExpectColumnMostCommonValueToBeInSet(
    column="colour", value_set={"Khaki", "Purple", "Grey"}
)
使用 Great Expectations 的数据质量入门

速查表

行级期望:

ExpectColumnValuesToNotBeNull(
    column: str
)
ExpectColumnValuesToBeOfType(
    column: str, type_: str
)

聚合级期望:

ExpectColumnDistinctValuesToEqualSet(
    column: str, value_set: set
)
ExpectColumnUniqueValueCountToBeBetween(
    column: str, 
    min_value: int, max_value: int
)
ExpectColumnValuesToBeUnique(column: str)
ExpectColumnMostCommonValueToBeInSet(
    column: str, value_set: set
)
使用 Great Expectations 的数据质量入门

¡Vamos a practicar!

使用 Great Expectations 的数据质量入门

Preparing Video For Download...