I have two date columns(format eg: 5/12/21) and need to find difference between them in days using pyspark. I tried but getting error.Need with Withcolumn.
date1 - date2 = result(in integer format)
I have two date columns(format eg: 5/12/21) and need to find difference between them in days using pyspark. I tried but getting error.Need with Withcolumn.
date1 - date2 = result(in integer format)
If you have column "date1"
and column "date2"
import pyspark.sql.functions as F
df = df.withColumn("numDaysDiff", F.datediff(F.col("date1"), F.col("date2")))