how to read csv file with missing columns and remove first and last delimiter of each row?
Looks like someone just saved lists of python with a csv extension. Maybe you can try to read those list and then transform them to a data frame. Just like this
with open('file.csv','r') as file:
data = file.readlines()
df = pd.DataFrame(data=data)
Any ways looks like your data doesn't have the same number of columns for each row.
Something like this maybe?
import re
with open('yourFile.csv','r') as f:
lines = f.readlines()
data = []
for line in lines:
print(line)
line = re.sub(r"\[|\]|\"|\n|'","",line) #match whatever you want to remove.
print(line)
data.append(line.split(","))
print(data)