我正在尝试将亚马逊评论数据加载到pandas dataframe,这是一个JSON文件,使用pd.read_json(),我收到以下错误Unmatched ''"' when when decoding 'string'.
我正在使用jupyter notebook
数据格式:
{"reviewerID": "AGL65XWV7MH3C", "asin": "B003FMUVKO", "reviewerName": "William B. Bebout \"Acknud\"", "helpful": [0, 1], "reviewText": "Too short. I would have rated it higher if it was long enough to hold my attention! It did have significant violence but not much else.", "overall": 3.0, "summary": "Short", "unixReviewTime": 1304985600, "reviewTime": "05 10, 2011"}
Python代码:
data =pd.read_json('sample_data.json', lines=True)
答案 0 :(得分:0)
我只是遇到了同样的错误,尝试了所有可能的解决方案后,简单的解决方法是删除文件末尾的空行。
在文件末尾留空行是一种常见的约定,但由于某种原因似乎使熊猫窒息了,