Trying to write my dataframe out as a tab separated .txt file but getting an error
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2021 02:10 PM
When I try to save my file I get
org.apache.spark.sql.AnalysisException: Text data source supports only a single column, and you have 2 columns.;
Is there any way to save a dataframe with more than one column to a .txt file?
Labels:
- Labels:
-
Dataframe
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2021 02:45 PM
Would pyspark.sql.DataFrameWriter.csv work? You could specify the separator (sep) as tab
df.write.csv(os.path.join(tempfile.mkdtemp(), 'data'))

