유형별 Expectations

Great Expectations로 배우는 데이터 품질 입문

Davina Moossazadeh

Data Scientist

수치 Expectations: 집계 수준

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로 배우는 데이터 품질 입문

수치 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로 배우는 데이터 품질 입문

문자열 Expectations

문자열 관련 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

문자열 열이 파싱 가능하도록 Expectations 설정

날짜용 ExpectColumnValuesToBeDateutilParseable():

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

JSON용 ExpectColumnValuesToBeJsonParseable():

gx.expectations.ExpectColumnValuesToBeJsonParseable(
    column="colour"
)
Great Expectations로 배우는 데이터 품질 입문

치트시트

수치 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)

문자열 Expectations:

ExpectColumnValueLengthsToEqual(column, value)

ExpectColumnValuesToMatchRegex(column, regex)

ExpectColumnValuesToMatchRegexList(
    column, regex_list
)

ExpectColumnValuesToBeDateutilParseable(column)

ExpectColumnValuesToBeJsonParseable(column)
Great Expectations로 배우는 데이터 품질 입문

연습해 봅시다!

Great Expectations로 배우는 데이터 품질 입문

Preparing Video For Download...