本文介绍了在Python中读取HDF文件的属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在读取熊猫的hdf文件时遇到问题.到目前为止,我还不知道文件的密钥.
I have a problem reading hdf file in pandas. As of now, I don't know the keys of the file.
在这种情况下,如何读取文件[data.hdf]?而且,我的文件是.hdf而不是.h5,它是否对数据获取有所不同?
How do I read the file [data.hdf] in such a case? And, my file is .hdf not .h5 , Does it make a difference it terms data fetching?
我看到您需要一个商店中的组标识符"
I see that you need a 'group identifier in the store'
pandas.io.pytables.read_hdf(path_or_buf, key, **kwargs)
我能够从pytables中获取元数据
I was able to get the metadata from pytables
File(filename=data.hdf, title='', mode='a', root_uep='/', filters=Filters(complevel=0, shuffle=False, fletcher32=False, least_significant_digit=None))
/ (RootGroup) ''
/UID (EArray(317,)) ''
atom := StringAtom(itemsize=36, shape=(), dflt='')
maindim := 0
flavor := 'numpy'
byteorder := 'irrelevant'
chunkshape := (100,)
/X Y (EArray(8319, 2, 317)) ''
atom := Float32Atom(shape=(), dflt=0.0)
maindim := 0
flavor := 'numpy'
byteorder := 'little'
chunkshape := (1000, 2, 100)
如何通过熊猫使其可读?
How do I make it readable via pandas?
推荐答案
首先(.hdf或.h5)没有什么区别.第二,我不确定熊猫,但是我读到HDF5键像:
First (.hdf or .h5) doesn't make any difference.Second, I'm not sure about the pandas, but I read the HDF5 key like:
import h5py
h5f = h5py.File("test.h5", "r")
h5f.keys()
或
h5f.values()
这篇关于在Python中读取HDF文件的属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!