0

I use export from pandas data frame in Jupyter:

        df_merged.to_csv(text_file, index=True, mode='a', sep=' ') 

In Jupyter all looks nice:

enter image description here

But when I download it I see that the lines are not separated:

enter image description here

Please, dont you know where the issue might be? Thanks!

RESULT: this helped for Windows:

        df_merged.to_csv(text_file, index=False, mode='a', sep='\t', line_terminator='\r\n')
HeadOverFeet
  • 768
  • 6
  • 13
  • 33

1 Answers1

1

It looks like:

  1. you are on Windows
  2. you are viewing the file in Notepad

Pandas will write out the csv file with newline '\n' only as the line separator. Notepad will only break a line if it has carriage returns '\r'.

I would recommend using a different text editor such as Notepad++

James
  • 32,991
  • 4
  • 47
  • 70