Apologies in advance, I assume this question was asked but I cannot find quickly. I have around 10 columns with names 'col 1', 'col 2', 'col 3' ... I want to apply the following function on each of them and the output should have base column name + 'avg'.
df['col 1 avg'] = df['col 1'].rolling(5).mean()
I can think of loop throw columns but I don't know how to do it in the easiest way. Thanks for help!