PySpark lit() – Add Literal or Constant to DataFrame
PySpark SQL functions lit() and typedLit() are used to add a new column to DataFrame…
0 Comments
August 12, 2020
PySpark SQL functions lit() and typedLit() are used to add a new column to DataFrame…
Adding a new column or multiple columns to Spark DataFrame can be done using withColumn(),…
Let's see how to add a new column by assigning a literal or constant value to Spark DataFrame. Spark SQL provides lit() and typedLit() function to add a literal value to DataFrame. These both functions return Column type.