小编Beo*_*orn的帖子

无法保留内存块,在python中导入json错误

import pandas as pd
with open(r'data.json') as f:
   df = pd.read_json(f, encoding='utf-8')
Run Code Online (Sandbox Code Playgroud)

我收到“无法保留内存块”错误。JSON 文件大小为 300MB。Python 中为正在运行的程序保留内存有限制吗?我的电脑有 8GB RAM,使用 Windows 10。

loading of json file into df
Traceback (most recent call last):
  File "C:\Program Files\JetBrains\PyCharm 2018.1.4\helpers\pydev\pydev_run_in_console.py", line 52, in run_file
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "C:\Program Files\JetBrains\PyCharm 2018.1.4\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "C:/Users/Beorn/PycharmProjects/project_0/projekt/test.py", line 7, in <module>
    df = pd.read_json(f, encoding='utf-8')
  File "C:\Users\Beorn\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pandas\io\json\json.py", line 422, in read_json
    result = json_reader.read()
  File "C:\Users\Beorn\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pandas\io\json\json.py", …
Run Code Online (Sandbox Code Playgroud)

python import json

6
推荐指数
1
解决办法
1万
查看次数

标签 统计

import ×1

json ×1

python ×1