pandas.read_json导致0xC0000005错误 - python

Python 3.7,Pycharm,Windows

我有一个.py文件,在其中我读取了带有pandas的json:

import pandas as pd

data = pd.read_json("a.json")
pd.DataFrame(data)

a.json:

[{"created_at": "Sun Oct 14 21:09:36 +0000 2018", "id": 1051580805624029189, "id_str": "1051580805624029189", "full_text": "@franceinfo \ud83e\udd14\ud83e\udd14\ud83e\udd14\ud83e\udd14 mais je croyais que la france etait un pays o\u00f9 on vit en s\u00e9curit\u00e9 ???..donc ces bandes VIVENT a la fran\u00e7aise o\u00f9 chacun fait sa loi.. C'est de mieux en mieux... Plus pire se sera la guerre ??????. \u00c7a a chang\u00e9 avec copin macron qui aime qui aime \ud83d\ude02", "truncated": false, "display_text_range": [12, 262], "entities": {"hashtags": [], "symbols": [], "user_mentions": [{"screen_name": "franceinfo", "name": "franceinfo", "id": 38395124, "id_str": "38395124", "indices": [0, 11]}], "urls": []}, "metadata": {"iso_language_code": "fr", "result_type": "recent"}, "source": "<a href=\"http://twitter.com/download/android\" rel=\"nofollow\">Twitter for Android</a>", "in_reply_to_status_id": 1051524872936050688, "in_reply_to_status_id_str": "1051524872936050688", "in_reply_to_user_id": 38395124, "in_reply_to_user_id_str": "38395124", "in_reply_to_screen_name": "franceinfo", "user": {"id": 1032612349914558469, "id_str": "1032612349914558469", "name": "ANDREAC64100531", "screen_name": "ANDREAC64100532", "location": "Jura, Franche-Comt\u00e9", "description": "", "url": null, "entities": {"description": {"urls": []}}, "protected": false, "followers_count": 2, "friends_count": 19, "listed_count": 0, "created_at": "Thu Aug 23 12:55:44 +0000 2018", "favourites_count": 178, "utc_offset": null, "time_zone": null, "geo_enabled": false, "verified": false, "statuses_count": 389, "lang": "en", "contributors_enabled": false, "is_translator": false, "is_translation_enabled": false, "profile_background_color": "F5F8FA", "profile_background_image_url": null, "profile_background_image_url_https": null, "profile_background_tile": false, "profile_image_url": "http://abs.twimg.com/sticky/default_profile_images/default_profile_normal.png", "profile_image_url_https": "https://abs.twimg.com/sticky/default_profile_images/default_profile_normal.png", "profile_link_color": "1DA1F2", "profile_sidebar_border_color": "C0DEED", "profile_sidebar_fill_color": "DDEEF6", "profile_text_color": "333333", "profile_use_background_image": true, "has_extended_profile": false, "default_profile": true, "default_profile_image": true, "following": false, "follow_request_sent": false, "notifications": false, "translator_type": "none"}, "geo": null, "coordinates": null, "place": null, "contributors": null, "is_quote_status": false, "retweet_count": 0, "favorite_count": 0, "favorited": false, "retweeted": false, "lang": "fr"},
{"created_at": "Sun Oct 14 20:49:27 +0000 2018", "id": 1051575737931698177, "id_str": "1051575737931698177", "full_text": "\ud83d\udd35 \u2066@alainjuppe\u2069 d\u00e9fend le projet europ\u00e9en d'\u2066@EmmanuelMacron\u2069 #Europe \ud83c\uddeb\ud83c\uddf7\ud83c\uddea\ud83c\uddfa", "truncated": false, "display_text_range": [0, 98], "entities": {"hashtags": [{"text": "Europe", "indices": [62, 69]}], "symbols": [], "user_mentions": [{"screen_name": "alainjuppe", "name": "Alain Jupp\u00e9", "id": 258345629, "id_str": "258345629", "indices": [3, 14]}, {"screen_name": "EmmanuelMacron", "name": "Emmanuel Macron", "id": 1976143068, "id_str": "1976143068", "indices": [45, 60]}], "urls": [{"url": "https://", "expanded_url": "http://www.atlantico.fr/pepites/alain-juppe-defend-projet-europeen-emmanuel-macron-3529872.html", "display_url": "atlantico.fr/pepites/alain-\u2026", "indices": [75, 98]}]}, "metadata": {"iso_language_code": "fr", "result_type": "recent"}, "source": "<a href=\"http://twitter.com/download/iphone\" rel=\"nofollow\">Twitter for iPhone</a>", "in_reply_to_status_id": null, "in_reply_to_status_id_str": null, "in_reply_to_user_id": null, "in_reply_to_user_id_str": null, "in_reply_to_screen_name": null, "user": {"id": 256915287, "id_str": "256915287", "name": "Nico Baudon #FBPE #AgirPourLEurope", "screen_name": "nicobaudon", "location": "Evreux, France", "description": "#Pharmacien | Soutien \u00e9ternel d'@alainjuppe |Soutien ind\u00e9fectible de @EPhilippePM | Membre fondateur @agir_officiel |Mes tweets n'engagent que moi.", "url": "https://t.co/", "entities": {"url": {"urls": [{"url": "https://t.co/", "expanded_url": "https://agir-ladroiteconstructive.fr", "display_url": "agir-ladroiteconstructive.fr", "indices": [0, 23]}]}, "description": {"urls": []}}, "protected": false, "followers_count": 10362, "friends_count": 10274, "listed_count": 737, "created_at": "Thu Feb 24 09:59:54 +0000 2011", "favourites_count": 247714, "utc_offset": null, "time_zone": null, "geo_enabled": true, "verified": false, "statuses_count": 282957, "lang": "fr", "contributors_enabled": false, "is_translator": false, "is_translation_enabled": false, "profile_background_color": "C0DEED", "profile_background_image_url": "http://abs.twimg.com/images/themes/theme1/bg.png", "profile_background_image_url_https": "https://abs.twimg.com/images/themes/theme1/bg.png", "profile_background_tile": false, "profile_image_url": "http://pbs.twimg.com/profile_images/802988831330959361/xIzMZQWl_normal.jpg", "profile_image_url_https": "https://pbs.twimg.com/profile_images/802988831330959361/xIzMZQWl_normal.jpg", "profile_banner_url": "https://pbs.twimg.com/profile_banners/256915287/1537783986", "profile_link_color": "1DA1F2", "profile_sidebar_border_color": "C0DEED", "profile_sidebar_fill_color": "DDEEF6", "profile_text_color": "333333", "profile_use_background_image": true, "has_extended_profile": true, "default_profile": true, "default_profile_image": false, "following": false, "follow_request_sent": false, "notifications": false, "translator_type": "regular"}, "geo": null, "coordinates": null, "place": null, "contributors": null, "is_quote_status": false, "retweet_count": 0, "favorite_count": 0, "favorited": false, "retweeted": false, "possibly_sensitive": false, "lang": "fr"}]

当我执行.py文件时,出现以下错误:

C:\Users\altab\PycharmProjects\project1\venv\Scripts\python.exe 
C:/Users/altab/PycharmProjects/project1/data-processing.py

Process finished with exit code -1073741819 (0xC0000005)

参考方案

这可能是熊猫中的虫子。

但是,我不确定JSON是否能正常工作,它似乎不是为熊猫read_json()设计的,不是吗?

至少,the documentation似乎暗示:

  (...)表示预期的JSON字符串格式。兼容的JSON字符串可以由to_json()生成,并具有相应的orient值。可能的东方方向是(...)

Pandas 数据框到烧瓶模板作为json - python

我尝试在烧瓶模板中输出熊猫数据框。我的想法是将其转换为json,然后遍历表我测试了jsonfiles = df.to_json(orient='records') return render_template('index.html', ctrsuccess=jsonfiles) 在模板中,我尝试这样输出: {%if …

Python uuid4,如何限制唯一字符的长度 - python

在Python中,我正在使用uuid4()方法创建唯一的字符集。但是我找不到将其限制为10或8个字符的方法。有什么办法吗?uuid4()ffc69c1b-9d87-4c19-8dac-c09ca857e3fc谢谢。 参考方案 尝试:x = uuid4() str(x)[:8] 输出:"ffc69c1b" Is there a way to…

Python:无法识别Pip命令 - python

这是我拍摄的屏幕截图。当我尝试在命令提示符下使用pip时,出现以下错误消息:pip无法识别为内部或外部命令,可操作程序或批处理文件。我已经检查了这个线程:How do I install pip on Windows?我所能找到的就是我必须将"C:\PythonX\Scripts"添加到我的类路径中,其中X代表python版本。如您在我的…

Python:如何将有效的uuid从String转换为UUID? - python

我收到的数据是 { "name": "Unknown", "parent": "Uncategorized", "uuid": "06335e84-2872-4914-8c5d-3ed07d2a2f16" }, 我需要将uuid从Strin…

Python 3会流行吗? - python

我已经学习了一些Python 2和Python 3,似乎Python 2总体上比Python 3更好。这就是我的问题所在。是否有充分的理由真正切换到python 3? 参考方案 总体上,甚至在大多数细节上,Python3都比Python2更好。关于第三方库, Python 3落后于的唯一区域是。使Python变得如此出色的原因不仅在于它作为一种语言的内在特性…