Skip to main content

Filter

Filters dataframe based on provided filter condition

Parameters

ParameterDescriptionRequired
DataframeInput dataframe on which the filter condition will be applied.True
Filter ConditionBooleanType column or boolean expression. Supports sql, python and scala expressions.True

Example

Example usage of Filter

Spark Code

def Filter_Orders(spark: SparkSession, in0: DataFrame) -> DataFrame:
return in0.filter(
(
((col("order_category") == lit("Marketing"))
& ((col("order_status") == lit("Finished")) | (col("order_status") == lit("Approved"))))
& ~ col("is_discounted")
)
)