Skip to main content

write (DataFrame)

Interface for saving the content of the non-streaming DataFrame out into external storage.

Returns

DataFrameWriter

Examples

Python
df = spark.createDataFrame([(2, "Alice"), (5, "Bob")], schema=["age", "name"])
type(df.write)
# <class '...readwriter.DataFrameWriter'>

Write the DataFrame as a table.

Python
df.write.saveAsTable("tab2")
On this page