Expectations เฉพาะประเภทข้อมูล

การตรวจสอบคุณภาพข้อมูลด้วย Great Expectations เบื้องต้น

Davina Moossazadeh

Data Scientist

Numeric Expectations: ระดับ aggregate

gx.expectations.ExpectColumnMeanToBeBetween(
    column="mark_price_usd", min_value=20, max_value=25
)

gx.expectations.ExpectColumnMedianToBeBetween( column="mark_price_usd", min_value=20, max_value=25 )
gx.expectations.ExpectColumnStdevToBeBetween( column="mark_price_usd", min_value=15, max_value=20 )
gx.expectations.ExpectColumnSumToBeBetween( column="mark_price_usd", min_value=20000, max_value=21000 )
การตรวจสอบคุณภาพข้อมูลด้วย Great Expectations เบื้องต้น

Numeric Expectations: ระดับแถว

กำหนด Expectations ระดับแถวสำหรับช่วงค่า:

gx.expectations.ExpectColumnValuesToBeBetween(
    column="star_rating", min_value=0, max_value=5
)

หรือลำดับ:

gx.expectations.ExpectColumnValuesToBeIncreasing(
    column="price_usd"
)

gx.expectations.ExpectColumnValuesToBeDecreasing( column="price_usd" )
การตรวจสอบคุณภาพข้อมูลด้วย Great Expectations เบื้องต้น

String Expectations

กำหนด String Expectations (ทั้งหมดอยู่ในระดับแถว):

gx.expectations.ExpectColumnValueLengthsToEqual(
    column="sku_id", value=18
)

gx.expectations.ExpectColumnValuesToMatchRegex( column="link", regex="^https://us.shein.com/[\w-]+" )
regex_list = [ "//img.ltwebstatic.com/images3_(spmp)|(pi)/202[0-4]/[0-1][0-9]/.*", "//sheinsz.ltwebstatic.com/she_dist/images/bg-g.*" ]
gx.expectations.ExpectColumnValuesToMatchRegexList( column="hero_image", regex_list=regex_list )
การตรวจสอบคุณภาพข้อมูลด้วย Great Expectations เบื้องต้น

Expectations สำหรับการ parse สตริง

กำหนด Expectations สำหรับคอลัมน์สตริงเพื่อตรวจสอบว่าข้อมูล parseable ได้

ExpectColumnValuesToBeDateutilParseable() สำหรับวันที่:

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

ExpectColumnValuesToBeJsonParseable() สำหรับ JSON:

gx.expectations.ExpectColumnValuesToBeJsonParseable(
    column="colour"
)
การตรวจสอบคุณภาพข้อมูลด้วย Great Expectations เบื้องต้น

สรุปคำสั่ง

Numeric Expectations:

ExpectColumn<METRIC>ToBeBetween(
    column, min_value, max_value
)
# <METRIC> in {"Mean", "Median", "Stdev", "Sum"}

ExpectColumnValuesToBeBetween(
    column, min_value, max_value
)

ExpectColumnValuesToBeIncreasing(column)

ExpectColumnValuesToBeDecreasing(column)

String Expectations:

ExpectColumnValueLengthsToEqual(column, value)

ExpectColumnValuesToMatchRegex(column, regex)

ExpectColumnValuesToMatchRegexList(
    column, regex_list
)

ExpectColumnValuesToBeDateutilParseable(column)

ExpectColumnValuesToBeJsonParseable(column)
การตรวจสอบคุณภาพข้อมูลด้วย Great Expectations เบื้องต้น

มาฝึกกันเถอะ!

การตรวจสอบคุณภาพข้อมูลด้วย Great Expectations เบื้องต้น

Preparing Video For Download...