【发布时间】:2017-10-24 15:24:45
【问题描述】:
我在dataframe1 中有一个列,其日期为today_date,我还有另一个dataframe2,其中包含days 以及其他列。我正在将这两个数据帧转换为一个临时表
我需要将dataframe1 和dataframe2 加入一列,然后添加today_date 和days。我正在使用sqlcontext 来查询这两个临时表
我目前正在使用date_add 函数。
sqlcontext.sql("select date_add(today_date,days) as 'Future_date' from dataframe1 x1 join dataframe2 x2 on x1.a=x2.a"
但是,它在 future_date 中返回 None 值。正在使用的配置单元版本已经很老了...我在pyspark 中运行此代码...
非常感谢任何帮助..
注意:我将 days 函数从 unicode 转换为 int 使用
dataframe2['days']=dataframe2['days'].astype(int)
【问题讨论】:
标签: python pyspark hiveql dateadd