我需要在HDF5数据库的特定时间范围内对时间序列数据进行大量连续查询(数据是以秒为单位的stord,并不总是"连续",我只知道开始和结束时间).因此,我想知道有一个比我现在的代码更快的解决方案,这是受这个答案的启发:
import pandas as pd
from pandas import HDFStore
store = HDFStore(pathToStore)
dates = pd.date_range(start=start_date,end=end_date, freq='S')
index = store.select_column('XAU','index')
ts = store.select('XAU', where=index[index.isin(dates)].index)
Run Code Online (Sandbox Code Playgroud)
任何意见和建议都非常感谢,谢谢!