Problems / Customer Classification Engine / Editorial
This problem tests the ability to translate multi-condition business rules into SQL CASE expressions or PySpark when/otherwise chains.
withColumn("discount_pct", F.when(F.col("tier") == "Platinum", 20)...)
tier
Forgetting that return_rate > 0.2 AND avg_order_value < 50 must be grouped with parentheses when combined with OR, or the precedence will produce wrong results.
return_rate > 0.2 AND avg_order_value < 50
Solve Customer Classification Engine yourself →