I have the following dataframe in pandas
Column 1 Column 2 Column3 Column 4
2 2 2 4
1 2 2 3
I am looking to create a dataframe which contains averages of columns 1& 2, Columns 3 &4, and so on.
ColumnAvg(12) ColumnAvg(34)
2 3
1.5 1.5
I was using this, but it is averaging everything.
df.mean(axis=1)
Is there a way, that I can add the column headers, when averaging each row. If not, another way would be to create two arrays, average them and then create a new dataframe.