pyspark.sql.DataFrameWriter.format

DataFrameWriter.format(source)[source]

Specifies the underlying output data source.

New in version 1.4.0.

Parameters:
sourcestr

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

Examples

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