以下行给出了 AttributeError: 'module' object has no attribute 'bdate_range'。
我认为这可能与循环引用有关;但是,我不知道在哪里。
import pandas as pd
times = pd.bdate_range(start=pd.datetime(2012,11,14,0,0,0),
end=pd.datetime(2012,11,17,0,0,0),
freq='10T')
这是回溯:
AttributeError Traceback (most recent call last)
<ipython-input-3-1eb62db1246d> in <module>()
4
5
----> 6 times = pd.bdate_range(start=pd.datetime(2012,11,14,0,0,0),end=pd.datetime(2012,11,17,0,0,0),
freq='10T')
7 filtered_times = [x for x in times if x.time() >= time(9,30) and x.time() <= time(16,20)]
8 prices = randn(len(filtered_times))
AttributeError: 'module' object has no attribute 'bdate_range'
请您参考如下方法:
bdate_range 函数是 introduced in pandas version 0.8.0 . 因此,如果您升级到 pandas >= 0.8.0(我建议使用最新的稳定版本),这应该可以正常工作。
注意:pandas website允许您按版本号搜索文档(在 main page 的右侧选择您的版本的文档)。在版本 0.7.3 中有 no search results for bdate_range .
