Save to text from pandas dataframe

I am trying to save my 2 column framework to a text file, I am getting this dtype array mismatch error, any suggestions on what I could do?

The error Image

+3


source to share


1 answer


Use DataFrame.to_csv

:

df.to_csv('hopefully.txt', index=False, sep=' ', header=None)

      



To save the file without commas, use sep=' '

. To disable the column header header=None

.

+4


source







All Articles