Pandas rolling transpose?

Viewed 332

Is it possible in pandas to transpose rolling window into row?

pandas.DataFrame.rolling

>> df
    Close
0   3.69 
1   9.14 
2   9.49 
3   15.84
4   17.00
5   26.31

There is tolling operation in pandas that can give me last N values I want to transpose, but how I can to insert them in to the row?

>> df
    Close    1       2      3 
0   3.69     NaN     NaN    NaN
1   9.14     3.69    NaN    NaN
2   9.49     9.14    3.69   NaN
3   15.84    9.49    9.14   3.69
4   17.00    15.84   9.49   9.14
5   26.31    17.00   15.84  9.49
1 Answers
Related