python json文件太大_Python:Json.load文件大型json文件内存

我试图加载一个大的JSON文件(300MB)来解析到excel。当我做一个json.load文件(文件)。类似的问题已经贴出来了,但还不能回答我的具体问题。我希望能够像在代码中那样在一个块中返回json文件中的所有数据。最好的办法是什么?代码和json结构如下:

代码是这样的。在def parse_from_file(filename):

""" proceed to load the json file that given and verified,

it and returns the data that was in the json file so it can actually be read

Args:

filename (string): full branch location, used to grab the json file plus '_metrics.json'

Returns:

data: whatever data is being loaded from the json file

"""

print("STARTING PARSE FROM FILE")

with open(filename) as json_file:

d = json.load(json_file)

json_file.close()

return d

结构看起来像这样。在

^{pr2}$

“内容”中的信息不一致,但有3个不同但不同的可能模板,可根据分析类型进行预测。在

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值