Mèh*_*ida 5 python dataframe apache-spark apache-spark-sql pyspark
在 PySpark 应用程序中,我尝试通过将数据帧转换为 Pandas 来转置数据帧,然后我想将结果写入 csv 文件。这就是我的做法:
df = df.toPandas().set_index("s").transpose()
df.coalesce(1).write.option("header", True).option("delimiter", ",").csv('dataframe')
Run Code Online (Sandbox Code Playgroud)
执行此脚本时,出现以下错误:
'DataFrame' object has no attribute 'coalesce'
Run Code Online (Sandbox Code Playgroud)
问题是什么?我该如何解决?
| 归档时间: |
|
| 查看次数: |
6172 次 |
| 最近记录: |