reading CSV error: Illegal Data. What's happening?

让人想犯罪 __ 提交于 2019-12-11 11:55:16

问题


I'm having the following error, and I have no idea what's going on...

Here is the first row in my csv file (I opened it using vim)

longitude,latitude,ph,ammonium_nitrate,phosphate,permanganate,heavy_metal,email_address^M

Here is the error I see in my safari console:

[Error] Error: CSVDataError: Illegal Data [Row:1][Col:8]
(anonymous function) (jquery-csv-0.71.js, line 253)
replace
parse (jquery-csv-0.71.js, line 160)
toArrays (jquery-csv-0.71.js, line 664)
success (demo.html, line 64)
c (jquery-1.10.2.min.js, line 4)
fireWith (jquery-1.10.2.min.js, line 4)
k (jquery-1.10.2.min.js, line 6)
r (jquery-1.10.2.min.js, line 6)

Any suggestions will be appreciated!! Thanks a lot!


回答1:


The file appears to be imported from a windows box (due to the presence of the ^M character). If you are working with this file in linux your parser may not like it. Remove the ^M from your file.



来源:https://stackoverflow.com/questions/23038327/reading-csv-error-illegal-data-whats-happening

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!