更新时间:2023-11-29 14:17:34
我能够使用selectExpr
解决此问题.
I was able to solve this using selectExpr
.
df.selectExpr('date_sub(date_col, day_col) as subtracted_dates')
如果要将列添加到原始DF,只需在表达式中添加*
If you want to append the column to the original DF, just add *
to the expression
df.selectExpr('*', 'date_sub(date_col, day_col) as subtracted_dates')