Pandas: Write CSV file with Windows line ending

Published: 25/09/2018
Pandas: Write CSV file with Windows line ending
Source: STACKOVERFLOW.COM

Example: import pandas as pd df = pd.DataFrame({'A':[1,2], 'B':[3,4]}) df.to_csv('test.csv', line_terminator='\r\n') gives the file ,A,B\r \r\n 0,1,3\r \r\n 1,2,4\r \r\n however, I would like to have ,A,B\r\n 0,1,3\r\n 1,2,4\r\n How can I achieve this (i.e., \r\n instead of \r\r\n ). My operating system is Windows 10.

Read more
Related news
Comment
FACEBOOK