pyspark.sql.DataFrameWriter.text

DataFrameWriter.text(path: str, compression: Optional[str] = None, lineSep: Optional[str] = None) → None[source]

Saves the content of the DataFrame in a text file at the specified path. The text files will be encoded as UTF-8.

New in version 1.6.0.

Parameters
pathstr

the path in any Hadoop supported file system

Other Parameters
Extra options

For the extra options, refer to Data Source Option in the version you use.

The DataFrame must have only one column that is of string type.
Each row becomes a new line in the output file.