【发布时间】:2014-11-17 13:06:04
【问题描述】:
方法 between_time 是在 pandas 面板对象中定义的,我希望此方法适用于面板中的所有数据框,但这不起作用。那么这个方法是做什么的呢?
例子
rng = pd.date_range('1/1/2013',periods=100,freq='D')
data = np.random.randn(100, 4)
cols = ['A','B','C','D']
df1, df2, df3 = pd.DataFrame(data, rng, cols), pd.DataFrame(data, rng, cols), pd.DataFrame(data, rng, cols)
pf = pd.Panel({'df1':df1,'df2':df2,'df3':df3})
pf.between_time('08:00:00', '09:00:00')
以上代码返回此错误
Traceback(最近一次调用最后一次):文件“”,第 1 行,in 文件 "/usr/lib64/python2.7/site-packages/pandas-0.14.0-py2.7-linux-x86_64.egg/pandas/core/generic.py", 第 2796 行,在 between_time raise TypeError('Index must be DatetimeIndex') TypeError: Index must be DatetimeIndex
【问题讨论】:
标签: python pandas indexing panel