Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2023 06:29 AM
I want to define a column with null values in my dataframe using pyspark. This column will later be used for other calculations.
What is the difference between creating it in these two different ways?
- df.withColumn("New_Column", lit(None))
- df.withColumn("New_Column", lit(None).cast('string'))
Can both be used? Is there a wrong one?
Thank you so much!
Labels:
- Labels:
-
Cast
-
New Column
-
Null Values