【发布时间】:2020-01-06 17:36:53
【问题描述】:
我目前正在尝试在 Python Spark 上将时间戳转换为日期格式 YYYY-MM-DD
例子:
table = random_name
start_time: 2017-03-25T12:58:16.000+0000
期望输出:2017-03-25
start_time: timestamp
代码:
x = spark.table(random_name)
display(x.withColumn('ts', to_timestamp(col('start_time')))
.withColumn('new_start_date', to_date(col('ts')))
但我得到了这个
SyntaxError: 解析时出现意外的 EOF
【问题讨论】: