spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dhaval Patel <dhaval1...@gmail.com>
Subject How to add a new column with date duration from 2 date columns in a dataframe
Date Thu, 20 Aug 2015 12:18:34 GMT
new_df.withColumn('SVCDATE2',
(new_df.next_diag_date-new_df.SVCDATE).days).show()

+-----------+----------+--------------+ | PATID| SVCDATE|next_diag_date|
+-----------+----------+--------------+ |12345655545|2012-02-13|
2012-02-13| |12345655545|2012-02-13| 2012-02-13| |12345655545|2012-02-13|
2012-02-27| +-----------+----------+--------------+

Mime
View raw message