Skip to content

Cuallee satisfies check usage #107

Closed Answered by canimus
FShinoda asked this question in Q&A
Discussion options

You must be logged in to vote

Data Prep

from cuallee import Check, CheckLevel
from pyspark.sql import SparkSession, Row, DataFrame

spark = SparkSession.builder.getOrCreate()

data = [
    Row(country="Brazil", color="green", population=214e6),
    Row(country="Mexico", color="white", population=126e6),
    Row(country="China", color="red", population=1.4e9),
]

df = spark.createDataFrame(data)
df.show(truncate=False)

DataFrame

+-------+-----+----------+
|country|color|population|
+-------+-----+----------+
|Brazil |green|2.14E8    |
|Mexico |white|1.26E8    |
|China  |red  |1.4E9     |
+-------+-----+----------+

Check

check = Check(CheckLevel.WARNING, "Satisfies")
check.satisfies("color", "(color like 'green') AND (…

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by FShinoda
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants