I'm currently trying to convert a timestamp into a date format of YYYY-MM-DD
on Python Spark
Example:
table = random_name
start_time: 2017-03-25T12:58:16.000+0000
output desired: 2017-03-25
start_time: timestamp
Code:
x = spark.table(random_name)
display(x.withColumn('ts', to_timestamp(col('start_time')))
.withColumn('new_start_date', to_date(col('ts')))
But I got this
SyntaxError: unexpected EOF while parsing
我猜你最后错过了一个括号“)”
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.