Chris Snow
Chris Snow

Reputation: 24588

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.

Upvotes: 5

Views: 13499

Answers (1)

Chris Snow
Chris Snow

Reputation: 24588

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")

Upvotes: 20

Related Questions