Reputation: 1807
I created an HDF5 file with:
pfad = "E:\Geld\Handelssysteme\Kursdaten\Ivolatity/Daten Monatsoptionen/ODAX_alles.h5"
df.to_hdf(pfad,'df', format='table')
Now I want to read and put a portion of the table back into a dataframe without reading all of the lines in the file.
I tried
df=pandas.read_hdf('pfad', 'df', where = ['expiration<expirations[1] and expiration>=expirations[0]'])
where expirations is a list that contains datetime64[ns] values and I want to get a dataframe where the values in column "expiration" are between expirations[1]
and expirations[0]
.
However, I get a KeyError: 'No object named df in the file'
What would the right syntax be?
Upvotes: 4
Views: 2738
Reputation: 1807
The following works instead:
hdf=pandas.HDFStore(pfad)
df=hdf.select('df')
Upvotes: 1