Skip to main content

Filter

Filters DataFrame based on the 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")
)
)