Python 2.7 在HD5查询中,表达式失败

Python 2.7 在HD5查询中,表达式失败,python-2.7,pandas,Python 2.7,Pandas,我想查询HDF5文件。我知道 df.to_hdf(pfad,'df', format='table') 将数据帧写入光盘 我用 hdf = pandas.HDFStore(pfad) 我有一个列表,其中包含名为expirations的numpy.datetime64值,并尝试将hd5表的部分读入一个数据帧,该数据帧的值在expirations[1]和expirations[0]列的expirations之间。列过期条目的格式为时间戳('2002-05-18 00:00:00') 我使用以下命

我想查询HDF5文件。我知道

df.to_hdf(pfad,'df', format='table')
将数据帧写入光盘

我用

hdf = pandas.HDFStore(pfad)
我有一个列表,其中包含名为expirations的
numpy.datetime64
值,并尝试将hd5表的部分读入一个数据帧,该数据帧的值在
expirations[1]
expirations[0]
列的
expirations
之间。列过期条目的格式为
时间戳('2002-05-18 00:00:00')

我使用以下命令:

df = hdf.select('df',
                where=['expiration<expiration[1]','expiration>=expirations[0]'])
df=hdf。选择('df',
其中=['expiration=expirations[0]'])
但是,这会失败并产生一个值错误:

ValueError: The passed where expression: [expiration=expirations[0]] contains an invalid variable reference all of the variable refrences must be a reference to an axis (e.g. 'index' or 'columns'), or a data_column The currently defined references are: index,columns ValueError:传递的where表达式:[expiration=expirations[0]] 包含无效的变量引用 所有变量引用都必须是对的引用 轴(例如“索引”或“列”)或数据列 当前定义的引用是:索引、列
保存框架时,需要将查询列指定为数据_列;请参阅我使用df.to_hdf(pfad,'df',format='table')编写的文档。当我使用store对象编写hd5文件时,您需要指定文档中所示的数据列。我遇到这个问题: