pandas.read_json приводит к ошибке 0xC0000005

1

Python 3.7, Pycharm, Windows

У меня есть.py файл, где я читал json с pandas:

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)
  • 0
    Я не мог воспроизвести вашу ошибку. Кроме того, data и pd.DataFrame(data) - это в точности pd.DataFrame(data) и pd.DataFrame(data) же структура данных (потому что pd.read_json возвращает DataFrame); нет смысла конвертировать DataFrame в другой DataFrame.
Теги:
pandas
python-3.x

2 ответа

0

тот же самый код работает на моей машине python 3.7 pycharm pandas = 0.23.4

вероятно, у вас есть пропущенная конфигурация в переменной среды, которую вы можете исправить

Изображение 174551

Следуйте инструкциям стрелки и добавьте содержимое:

= c: c\"

Изображение 174551

0

Вероятно, это ошибка в пандах.

Тем не менее, я не уверен, что JSON когда-либо будет работать, это не похоже на pandas read_json(), нет?

По крайней мере, документация, по- видимому, предполагает, что:

(...) Индикация ожидаемого формата строки JSON. Совместимые строки JSON могут быть созданы to_json() с соответствующим ориентированным значением. Набор возможных ориентиров (...)

Ещё вопросы

Сообщество Overcoder
Наверх
Меню