This can be a repetition but I didn't really find any specific post on the same.
I have two dataframes "df" and "nm". They have same rows and columns and also column names are same.
df
User Apple Cherry Kiwi Lemon
A 208 71 129 58
B 81 69 142 53
C 164 212 175 200
D 125 73 51 214
E 205 123 46 75
F 53 215 40 38
nm
User Lemon Cherry Apple Kiwi
A 161 57 27 38
B 26 153 57 45
C 39 153 219 86
D 47 155 139 61
E 143 40 59 130
F 183 77 71 133
Note that column index for similar column names are not same.
I want to create new data frame "kl" where I want the aggregate value as per "User" for each column name i.e.
kl
User Apple Cherry Kiwi Lemon
A 117.5 64 83.5 109.5
B 69 111 93.5 39.5
C 191.5 182.5 130.5 119.5
D 132 114 56 130.5
E 132 81.5 88 109
F 62 146 86.5 110.5