是否可以使用Pytables(或Pandas)来检测hdf文件的表是否包含某个列?加载我使用的hdf文件:Pytables检查列是否存在
from pandas.io.pytables import HDFStore
# this doesn't read the full file which is good
hdf_store = HDFStore('data.h5', mode='r')
# returns a "Group" object, not sure if this could be used...
hdf_store.get_node('tablename')
我也可以直接使用Pytables而不是Pandas。目的不是加载hdf文件的所有数据,因为这些文件可能很大,我只想确定是否存在某个列。
试试这个:'hdf_store [“表名”] columns' – MaxU
这需要很长的时间才能完成(3GB HDF文件),所以我想这是拉动完整的文件。但它返回列。 – orange