pyspark.sql.DataFrameWriter.format

DataFrameWriter.format(source: str) → pyspark.sql.readwriter.DataFrameWriter

Specifies the underlying output data source.

Parameters
sourcestr

string, name of the data source, e.g. ‘json’, ‘parquet’.

Examples

>>> df.write.format('json').save(os.path.join(tempfile.mkdtemp(), 'data'))