基本的な列のExpectation

Great Expectationsで始めるデータ品質入門

Davina Moossazadeh

Data Scientist

Shein Footwearデータセット

KaggleのShein Footwearデータセットの最初の5行を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で始めるデータ品質入門

行レベルのExpectation

  • 行レベルのExpectationは各行に個別に適用
    • すべての行で条件を満たす場合のみ成功
Great Expectationsで始めるデータ品質入門

行レベルのExpectation

欠損のExpectation

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

型のExpectation

gx.expectations.ExpectColumnValuesToBeOfType(
    column="review_count", type_="str"
)
Great Expectationsで始めるデータ品質入門

集計レベルのExpectation:異なる値

異なる値集合のExpectation

gx.expectations.ExpectColumnDistinctValuesToEqualSet(
    column="seller_name", value_set={"Womens Shoes"}
)
Great Expectationsで始めるデータ品質入門

集計レベルのExpectation:一意値数

一意値数のExpectation

gx.expectations.ExpectColumnUniqueValueCountToBeBetween(
    column="review_count", min_value=5, max_value=101
)
Great Expectationsで始めるデータ品質入門

集計レベルのExpectation:一意性

一意性のExpectation

gx.expectations.ExpectColumnValuesToBeUnique(
    column="sku_id"
)
Great Expectationsで始めるデータ品質入門

集計レベルのExpectation:最頻値

最頻値のExpectation

gx.expectations.ExpectColumnMostCommonValueToBeInSet(
    column="colour", value_set={"Khaki", "Purple", "Grey"}
)
Great Expectationsで始めるデータ品質入門

チートシート

行レベルのExpectation:

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

集計レベルのExpectation:

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で始めるデータ品質入門

Ayo berlatih!

Great Expectationsで始めるデータ品質入門

Preparing Video For Download...