У меня есть CSV-файл, и я хотел бы прочитать его с помощью библиотеки панд в Python.
Вот заголовок и первая строка моего файла.
content,topic,class,NRC-Affect-Intensity-anger_Score,NRC-Affect-Intensity-fear_Score,NRC-Affect-Intensity-sadness_Score,NRC-Affect-Intensity-joy_Score
'@stellargirl I loooooooovvvvvveee my Kindle2. Not that the DX is cool, but the 2 is fantastic in its own right.',kindle2,positive,0,0,0,0
Он разделен запятыми и имеет 7 полей. Когда я попытался прочитать этот файл, я получил ошибку:
zz= pd.read_csv('proc_data.csv', sep=',')
Error tokenizing data. C error: Expected 8 fields in line 14, saw 9
Я полагаю, что это комплан для запятых в первом столбце (Часть между '
символами)
Можно ли правильно прочитать этот файл?
head -15 less proc_data.csv
head: less: No such file or directory
==> proc_data.csv <==
content,topic,class,NRC-Affect-Intensity-anger_Score,NRC-Affect-Intensity-fear_Score,NRC-Affect-Intensity-sadness_Score,NRC-Affect-Intensity-joy_Score
'@stellargirl I loooooooovvvvvveee my Kindle2. Not that the DX is cool, but the 2 is fantastic in its own right.',kindle2,positive,0,0,0,0
'Reading my kindle2... Love it... Lee childs is good read.',kindle2,positive,0,0,0,1.375
'Ok, first assesment of the #kindle2 ...it fucking rocks!!!',kindle2,positive,0,0,0,0
'@kenburbary You\'ll love your Kindle2. I\'ve had mine for a few months and never looked back. The new big one is huge! No need for remorse! :)',kindle2,positive,0,0,0.594,1.125
'@mikefish Fair enough. But i have the Kindle2 and I think it\'s perfect :)',kindle2,positive,0,0,0,0.719
'@richardebaker no. it is too big. I\'m quite happy with the Kindle2.',kindle2,positive,0,0,0,0.788
'Fuck this economy. I hate aig and their non loan given asses.',aig,negative,0.828,0.484,0.656,0
'Jquery is my new best friend.',jquery,positive,0,0,0,0.471
'Loves twitter',twitter,positive,0,0,0,0
'how can you not love Obama? he makes jokes about himself.',obama,positive,0,0,0,0.828
'Check this video out -- President Obama at the White House Correspondents\' Dinner ',obama,neutral,0,0,0,0.109
'@Karoli I firmly believe that Obama/Pelosi have ZERO desire to be civil. It\'s a charade and a slogan, but they want to destroy conservatism',obama,negative,0,0,0,0.484
'House Correspondents dinner was last night whoopi, barbara & sherri went, Obama got a standing ovation',obama,positive,0,0,0.078,0
'Watchin Espn..Jus seen this new Nike Commerical with a Puppet Lebron..sh*t was hilarious...LMAO!!!',nike,positive,0,0,0,0.672