【发布时间】:2020-03-26 11:34:47
【问题描述】:
我在 AWS S3 中有一个 csv 文件,当我执行爬虫时,日期为 01/01/2016 04.21 的字段在 AWS 胶水中被视为字符串。
如何将其更改为日期类型?
我尝试使用 AWS Glue 中的“修改架构”按钮,但它最终有一个空白字段。
【问题讨论】:
-
修改后的架构中日期列的格式是什么
标签: pyspark etl aws-glue amazon-athena
我在 AWS S3 中有一个 csv 文件,当我执行爬虫时,日期为 01/01/2016 04.21 的字段在 AWS 胶水中被视为字符串。
如何将其更改为日期类型?
我尝试使用 AWS Glue 中的“修改架构”按钮,但它最终有一个空白字段。
【问题讨论】:
标签: pyspark etl aws-glue amazon-athena
将动态帧转换为 Pyspark 数据帧并将 Pyspark 用于所有内容。更简单:
from pyspark.sql.functions import from_unixtime, unix_timestamp, col
df= dyf.toDF()
df = df.withColumn(col(columnname), from_unixtime(unix_timestamp(col(columnname),"dd/MM/yyyy hh.mm")))
【讨论】: