I performed a measurement where I changed a parameter and measured a physical quantity. I performed multiple measurements and saved the data to a pandas dataframe. The result looks something like this:
parameter measured_value
0 10 1.10
1 20 1.21
2 30 1.29
3 40 1.42
4 50 1.54
5 10 1.14
6 20 1.22
7 30 1.32
8 40 1.41
9 50 1.52
In that example I repeated the measurement twice and varied the parameter from 10 to 50 in steps of 10. Is there a way to to average the measured values, such that I get the following result:
parameter mean_measured_value
0 10 1.10
1 20 1.20
2 30 1.30
3 40 1.40
4 50 1.50
I analyze my data typically with matlab. Basically, I could use numpy to do data analysis like matlab, but this looks quiet unelegant:
meas_value = np.asarray(df['measured_value'])
mean_meas_value = np.mean(np.reshape(meas_value, (5,2)), axis=1)
Is there an elegant way with pandas?