不幸的是,这有点慢,但是至少应该给出您想要的答案。
#create an index of just the date portion of your index (this is the slow step)ts_days = pd.to_datetime(ts.index.date)#create a range of business days over that periodbdays = pd.bdate_range(start=ts.index[0].date(), end=ts.index[-1].date())#Filter the series to just those days contained in the business day range.ts = ts[ts_days.isin(bdays)]
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)