
这是我试过的:
import datetimeNow = datetime.datetime.Now()df = df.withColumn("date",str(Now)[:10]) 我收到此错误:
解决方法AssertionError: col should be Column
How to create a new column in PySpark and fill this column with the date of today?
已有功能:
from pyspark.sql.functions import current_datedf.withColumn("date",current_date().cast("string")) AssertionError: col should be Column
使用文字
from pyspark.sql.functions import litdf.withColumn("date",lit(str(Now)[:10])) 总结 以上是内存溢出为你收集整理的python – AssertionError:col应该是Column全部内容,希望文章能够帮你解决python – AssertionError:col应该是Column所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)