📜  pyspark case when - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:10.704000             🧑  作者: Mango

代码示例1
# PYSPARK DATAFRAME API

from pyspark.sql.functions import when

df.select("*",when(df.value == 1, 'one'
            ).when(df.value == 2, 'two'
            ).otherwise('other'))