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)