Reputation: 716
I am trying to get the mean RT which is the time given a user and given their response. What I did was use group by and then the mean but that gives me a number which is not the mean.
This is an example of the data:
Person ID value word rt emotional_w
0 V CHOQUE 116 TRUE
0 A SILLA 434 TRUE
0 R BRAZO 480 FALSE
1 A LLUVIA 1091 FALSE
1 R SOLEDAD 637 TRUE
1 R EDAD 6376 TRUE
This is what I did:
rt_mean = df.groupby(['Person ID', 'emotional_w'])['rt'].mean()
This returns this (the numbers above are only a few so this shows something very different):
Person ID emotional_w rt
0 False 9.05166894115559E+145
0 True 3.76010399264845E+108
1 False 2.56285856539796E+162
1 True 3.0308641569192E+118
The thing is, given my data, that is nowhere near the actual mean so how could I get it? Thank you.
Upvotes: 0
Views: 414
Reputation: 262284
double check your data and types, the provided code works as expected:
df.groupby(['Person ID', 'emotional_w'])['rt'].mean()
output:
Person ID emotional_w
0 False 480.0
True 275.0
1 False 1091.0
True 3506.5
Upvotes: 1