python加载数据集_读取h5数据集python的一部分
I'm reading in large sets of data from an .h5 file, (200,000 points per dataset) and I currently don't need all of it so what I've been doing is reading in the data, then truncating it after.Is there

I'm reading in large sets of data from an .h5 file, (200,000 points per dataset) and I currently don't need all of it so what I've been doing is reading in the data, then truncating it after.
Is there a way to only read the first X items of an h5 dataset?
解决方案
Use this...
import numpy as np
import h5py
filename = 'file.hdf5'
f = h5py.File(filename, 'r')
key = list(f.keys())[0]
data = list(f[key][1])
Indexing may vary for key and f[key], where [0] is an arbitrary dataset of file.hdf5 and [1] is just an arbitrary column I grabbed.
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐

所有评论(0)