I have time-indexed data:
df2 = pd.DataFrame({ \'day\': pd.Series([date(2012, 1, 1), date(2012, 1, 3)]), \'b\' : pd.Series([0.22, 0.3]) }) df2 = df2.set_index(\'
def extendframe(df, ndays): """ (df, ndays) -> df that is padded by ndays in beginning and end """ ixd = df.index - datetime.timedelta(ndays) ixu = df.index + datetime.timedelta(ndays) ixx = df.index.union(ixd.union(ixu)) df_ = df.reindex(ixx) return df_