简体   繁体   中英

TypeError: 'DataFrameWriter' object is not callable

I'm trying to save a data frame to object storage:

print(type(saveDF))
<class 'pyspark.sql.dataframe.DataFrame'>

Then:

saveDF.write().option("header", "true").csv("pre-processed")

Results in:

TypeErrorTraceback (most recent call last)
<ipython-input-90-d20d6b31a2d4> in <module>()
      1 ----> saveDF.write().csv("pre-processed")

TypeError: 'DataFrameWriter' object is not callable

I've seen a number of other questions with this problem, but the questions are using a different approach to saving as a csv.

The issue was a simple fix. Instead of this:

saveDF.write().option("header", "true").csv("pre-processed")

It should have been:

saveDF.write.option("header", "true").csv("pre-processed")

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM