Hello,
I am trying to do something relatively simple - load a csv file and create a list (or a dataframe). The separator for my file is "|", but the data in my csv file can have all the other characters - ",':, space, etc. Need to ignore them all - but the code that I have messes up when looking through that file. Any help would be appreciated!
I am still not able to upload files (do not have five posts yet), so I am posting the sample CSV:
What I need to have is a table/list that look like this:
![[Image: final-output.png]](https://i.ibb.co/7ykbGzr/final-output.png)
Basically, it should ignore all characters other than "|" when creating each of the fields (theoretically the CSV field can have tabs, newlines, etc as well).
I would appreciate any help!
I am trying to do something relatively simple - load a csv file and create a list (or a dataframe). The separator for my file is "|", but the data in my csv file can have all the other characters - ",':, space, etc. Need to ignore them all - but the code that I have messes up when looking through that file. Any help would be appreciated!
#load dataframe from csv import csv import pandas as pd df1 = pd.read_csv('reports/reports_test.csv', delimiter='|') print(df1)
I am still not able to upload files (do not have five posts yet), so I am posting the sample CSV:
Quote:1|2|3|4
"A zasdff|B sdafasfd,as dfsadf""|C & D are here|D
More data|12, 124, 12|weird delimiters:'no way|stuff
12|><(yes|111|stuff and other stuff
What I need to have is a table/list that look like this:
![[Image: final-output.png]](https://i.ibb.co/7ykbGzr/final-output.png)
Basically, it should ignore all characters other than "|" when creating each of the fields (theoretically the CSV field can have tabs, newlines, etc as well).
I would appreciate any help!