Reputation: 10099
Im trying to save my dataframe which consists of 2 colums into a text file,I get this error of mismatch between array dtype,any suggestions on what i could do?
Upvotes: 4
Views: 6780
Reputation: 862431
Use DataFrame.to_csv
:
df.to_csv('hopefully.txt', index=False, sep=' ', header=None)
For the file to be saved without a comma, use the sep=' '
. To cut off the column title, header=None
.
Upvotes: 7