I am trying to read a text file containing the following (around 1 million rows):
First Line: "column_header", "column_header", "column_header", "column_header"
Second line onwards: "value", "value", "value", "value"
I tried the following:
''' try 1 '''
with open(file, 'rt') as f:
contents = f.readlines()
for i in contents:
print(i) # ->> seeing the text as ," value ", " value ", "
x = [_.strip().replace('""', '').split(',') for _ in i]
print(str(x)) # ->> getting bytez
''' try 2 '''
with open(file, 'rt') as f:
contents = f.read()
for i in contents:
print(str(i)) # ->> text but cannot do anything
''' try 3 '''
frame = pd.read_csv(file, sep=',', doublequote=True, skip_blank_lines=True) # ->> utf parsing error