So, I want to create a new column in my dataframe, whose rows depend upon values from two columns, and also involves a condition.
I tried this, but it doesn't work.
some_value = ...
df = df.withColumn("new_col", col("col1") if col("col2") == some_value else None)
What is the correct way of doing this?