Skip to content
RED SAG Skills
easy5 pts · first answer countssparkspark-sql-functions

when() with no otherwise()

What value does the band column get for a row where amount is 300?

df.withColumn("band",
    F.when(F.col("amount") > 1000, "high")
     .when(F.col("amount") > 500, "mid"))
Choose one answer

Discussion 0

Join free to post in the discussion.

Related questions