The correct way to overwrite an existing file using the DataFrameWriter is:
df.write.mode("overwrite").json("path/to/file")
Option D is also technically valid, but Option A is the most concise and idiomatic PySpark syntax.
[Reference: PySpark DataFrameWriter API, ]
Contribute your Thoughts:
Chosen Answer:
This is a voting comment (?). You can switch to a simple comment. It is better to Upvote an existing comment if you don't have anything to add.
Submit