I got it, though I expected something much simpler.
I hope there's a more elegant solution!
df['C'] = 0.0 for i in df.index: df['C'][i] = df[['A', 'B']][i:].mean().mean() print(df)But do we have to use this for loop to go through all values? One of the best things of dataframe is that it can deal with a complex frame once only when applying function, without the need of going through looping which is not good for optimal performance.
I hope there's a more elegant solution!