Answers for "case class in pyspark"

0

pyspark case when

# PYSPARK DATAFRAME API

from pyspark.sql.functions import when

df.select("*",when(df.value == 1, 'one'
            ).when(df.value == 2, 'two'
            ).otherwise('other'))
Posted by: Guest on May-31-2021

Python Answers by Framework

Browse Popular Code Answers by Language