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?
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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With