I am reading a file that has \n
as a new line character. But when I read it using pandas, it appears as \\n
. How can I avoid this?
I tried both pandas and python csv but nothing worked
I am reading a file that has \n
as a new line character. But when I read it using pandas, it appears as \\n
. How can I avoid this?
I tried both pandas and python csv but nothing worked
in pandas, you can set lineterminator to '\n' and that should work. Alternatively, you can use the csv module in python to read your csv file as follows :
import csv
with open(filepath, newline='', encoding='utf-8') as f:
reader = csv.reader(f, delimiter='\n')
for row in reader:
print(row)