I used Python to calculate a column average in a dataframe. I used the following command to calculate the summation of data in defined column. But, I do not exactly know why the output result is just appended data without any summation.
df3 = pd.merge(df1, df2, how = 'inner', on = 'key')
df3
df3['age'].sum()
The output result is:
>>key data1 data2 age
42 0.01 1200 17
101 0.02 523 10
>>1710
So, as you see the sum function is just append '17' and '10' and the result is 1710. For mean function I again get 1710/2 = 855.
Could you please put any comment?