How do I use multiple conditions with pyspark.sql.functions.when()? August 12, 2023 by Tarik Use parentheses to enforce the desired operator precedence: F.when( (df["col-1"]>0.0) & (df["col-2"]>0.0), 1).otherwise(0)