pandas Python以退出代码-1073741819终止进程
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28447567/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Python terminates process with exit code -1073741819
提问by Nitin Kashyap
I am trying to read a csv file (~190MB in size) into a pandas dataframe, but I am getting this error. I am running the Pycharm IDE from JetBrains
我正在尝试将 csv 文件(大小约 190MB)读入 Pandas 数据帧,但出现此错误。我正在从 JetBrains 运行 Pycharm IDE
Process finished with exit code -1073741819 (0xC0000005)
The code I am trying to run is below:
我试图运行的代码如下:
from pandas import DataFrame as df
if __name__ == '__main__':
frame = df()
frame.from_csv('c:/Nitin/692/Python/CSV/21LIVvTOT_user_geo_Reply.csv', header=True)
ab = list(frame.columns.values)
print(ab)
Here is an instance from the CSV:
这是来自 CSV 的一个实例:
createdat text coordinates entities id_str in_reply_to_user_id_str
Tue Feb 10 18:56:42 +0000 2015
"RT @RubieDubes: official list of deluded XXXXX:
Spurs Fans
Kanye West
Louis van Gaal"
{'trends': [], 'urls': [], 'user_mentions': [{'id': 65174814, 'name': 'Ruby ?', 'screen_name': 'RubieDubes', 'indices': [3, 14], 'id_str': '65174814'}], 'symbols': [], 'hashtags': []}
5.65223E+17
EDIT: I tried running it using the python console and it resulted in an error: An unhandled win32 exception occurred in python.exe [11640].
编辑:我尝试使用 python 控制台运行它,结果出现错误:python.exe [11640] 中发生未处理的 win32 异常。
采纳答案by Nitin Kashyap
I figured out what the issue was. There were values in the CSV like that were not being properly read by the parser. I changed the code from
我想出了问题所在。解析器没有正确读取 CSV 中的值。我改变了代码
frame.from_csv('c:/Nitin/692/Python/CSV/21LIVvTOT_user_geo_Reply.csv', header=True)
to
到
data = pandas.read_csv('c:/Nitin/692/Python/CSV/21LIVvTOT_user_geo_Reply.csv', encoding='latin-1', engine='python')
Guess the encoding in utf-8 was causing the problem. The code ran when I changed it to 'latin-1. Thank you for your help.
猜猜 utf-8 中的编码导致了问题。当我将其更改为“latin-1”时,代码运行。感谢您的帮助。
EDIT: I figured that this was caused due to the emojis present in the data.
编辑:我认为这是由于数据中存在的表情符号引起的。

