QuestionQ77Verified/Developing Apache Spark™ DataFrame/DataSet API ApplicationsCopy linkReport a problemAsk AstroTutorSave questionWhich command replaces an existing JSON file while writing a DataFrame?Adf.write.mode("overwrite").json("path/to/file")Bdf.write.overwrite.json("path/to/file")Cdf.write.json("path/to/file", overwrite=True)Ddf.write.format("json").save("path/to/file", mode= “overwrite")Show AnswerAnswerExplanationDataFrameWriter.mode("overwrite") configures the write operation to replace existing data, and json(path) writes the DataFrame in JSON format. The documented JSON-writing API also supports overwrite mode. PySpark DataFrameWriter.mode and PySpark DataFrameWriter.json.Learn morePySpark DataFrameWriter.modePySpark DataFrameWriter.jsonShow comments0Show commentsCommunity DiscussionNo comments yet. Be the first to start the discussion!
Community Discussion