DataFrameWriter.
format
Specifies the underlying output data source.
New in version 1.4.0.
string, name of the data source, e.g. ‘json’, ‘parquet’.
Examples
>>> df.write.format('json').save(os.path.join(tempfile.mkdtemp(), 'data'))