h5py - 如何列出h5py文件中的所有数据集?

标签 h5py

我有一个存储 numpy 数组的 h5py 文件,但我得到了 Object doesn't exist error当尝试使用我记得的数据集名称打开它时,有没有办法列出文件具有的数据集?

   with h5py.File('result.h5','r') as hf:
        #How can I list all dataset I have saved in hf?

最佳答案

您必须使用 key 方法。这将为您提供数据集和组名称的 unicode 字符串列表。
例如:

Datasetnames=hf.keys()

另一种基于 gui 的方法是使用 HDFView。
https://support.hdfgroup.org/products/java/release/download.html

关于h5py - 如何列出h5py文件中的所有数据集?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44883175/

相关文章:

python - 通过 h5py (HDF5) 写入具有可变长度字符串的复合数据集

python - 从 python 加载 .mat 文件

conda - 在 conda 上导入 h5/h5py 时出错 : undefined symbol: H5Pget_fapl_direct

python - 我应该重复打开/关闭文件还是长时间保持打开状态(约 1 周)?

python - 将HDF5文件读入numpy数组

pip - HDF5 库和 header 不匹配错误

python - 你如何关闭 python 列表理解中的文件?

python - h5py,在SVHN中访问Datasets中的数据

python - 有使用 h5py 在 Python 中对大数据进行分析工作的经验吗?

Python: h5py 给出 OSError: Can't read data (inflate() failed) 即使它之前打开过