I have some questions about pandas dataframe reading csv file, and split column by comma. I have a csv file with only 1 column(with multiple rows, and I have to split column by comma.
assume the the dataframe is like "a", "b", 2021-05-01 00:00:00, "Tim, hortons" with 4 comma splited, and 1 commna in string
I wanted it to be splited like a, b, 2021-05-01 00:00:00, Tim hortons in 4 columns
but when I use df[0].str.split(',', expand=True), it be comes
a, b, 2021-05-01 00:00:00, Tim, hortons in 5 columns.
It did not ignore the comma between the double quote " ". Not all field are string type like the date, but all string are surround with ""
my code is like
In [1]: df = pd.DataFrame(["a", "b", 2021-05-01 00:00:00, "Tim, hortons"])
with sftp.open(a) as f:
df = pd.DataFrame(f)
df = df[0].str.split(',', expand=True)
someone please help!!! its been bugging me for a long time. Thank you !!!!