问题是
import pandas as pd
dataFrame = pd.read_csv('dow_jones_index.data',parse_dates=["date"], index_col="date")
dataFrame.head()
closeTS = dataFrame[(dataFrame.stock == 'AA')].close.str.replace('$',' ').astype(float)
对上述步骤中过滤的数据进行向下采样,并执行插值以正向填充前两个“NaN”值。 将下采样数据的前10个样本返回变量“downsample”
我试过下面的方法
downsample1 = closeTS.resample('D', fill_method='ffill')
downsample = downsample1.interpolate(method='linear',limit=None,limit_direction='forward')
print(downsample.head(10))
然而,上面的代码似乎不起作用
目前没有回答
相关问题 更多 >
编程相关推荐