I have a DataFrame like:
subject gender Weight Temperature X Y Z sensor test etc.....
101 male 80 23 0.824 0.26 1.20 Head 1
101 male 70 23 0.826 0.24 1.23 Head 1
101 male 81 23 0.829 0.26 1.24 Foot 1
101 male 85 23 0.820 0.23 1.28 Foot 1
101 male 80 23 0.821 0.24 1.24 Head 2
101 male 70 23 0.825 0.24 1.23 Head 2
101 male 81 23 0.829 0.26 1.24 Foot 2
101 male 85 23 0.820 0.23 1.28 Foot 2
so, i want to realize a dataframe where :
- I join the rows considering "sensor" and "test" in the columns where is possible ( where there are numeric values) and I create new columns with : mean, variance and standard deviation of this numbers.
Attention: the subject is the same ( "101" ) and the sensor's name are repeated in different tests.
than in final dataset, this operation is iterated on many subject( 101,102,103...).
in this example i would have somethings like:
subject gender Weight Temperature X(mean) X(variance) X(sd) Y(mean) Y(variance)..... sensor test
101 male 75 23 0.825 "xxx" "xxx" "xxx" Head 1
101 male 83 23 0.819 "xxx" "xxx" "xxx" Foot 1
101 male 75 23 0.823 "xxx" "xxx" "xxx" Head 2
. .
. .
. .
.
etc...... ................
Thanks in advance.