Murthy1
Contributor II

Hello!

An elegant way of defining an empty column in a dataframe is to mention as

df.withColumn("New_Column", lit(None).cast(StringType()))

If you are just working with dataframes ( and no file formats are involved) you can also work with NullType().

View solution in original post