Skip to content Skip to sidebar Skip to footer

Using Resample To Align Multiple Timeseries In Pandas

Here's the setup code: import pandas from datetime import datetime a_values = [1728, 1635, 1733] a_index = [datetime(2011, 10, 31), datetime(2012, 1, 31), datetime(2012, 4, 30)] a

Solution 1:

df1 = DataFrame({'a':a})
df2 = DataFrame({'aa':aa})
df3 = DataFrame({'apol':apol})
df=df1.append([df2,df3]).sort_index()
print df.resample('Q-APR',loffset='-1m').T

Output:

      2011-09-30  2011-12-31  2012-03-31
a           1728        1635        1733
aa          6419        5989        6006
apol        1100        1179         969

Post a Comment for "Using Resample To Align Multiple Timeseries In Pandas"