如何列出h5py文件中的所有数据集? [英] How to list all datasets in h5py file?

查看:388
本文介绍了如何列出h5py文件中的所有数据集?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个存储numpy数组的h5py文件,但是尝试用我记得的数据集名称打开它时却得到了Object doesn't exist error,所以有什么办法可以列出该文件具有哪些数据集?

I have a h5py file storing numpy arrays, but I got Object doesn't exist error when trying to open it with the dataset name I remember, so is there a way I can list what datasets the file has?

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

推荐答案

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

You have to use the keys method. This will give you a List of unicode strings of your dataset and group names. For example:

Datasetnames=hf.keys()

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

Another gui based method would be to use HDFView. https://support.hdfgroup.org/products/java/release/download.html

这篇关于如何列出h5py文件中的所有数据集?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆