【发布时间】:2018-03-09 22:07:51
【问题描述】:
在 PySpark 应用程序中,我尝试通过将数据帧转换为 pandas 来转置数据帧,然后我想将结果写入 csv 文件。我就是这样做的:
df = df.toPandas().set_index("s").transpose()
df.coalesce(1).write.option("header", True).option("delimiter", ",").csv('dataframe')
执行此脚本时出现以下错误:
'DataFrame' object has no attribute 'coalesce'
有什么问题?我该如何解决?
【问题讨论】:
标签: python apache-spark dataframe pyspark apache-spark-sql