My dataframe looks like this:
exp itr res1
e01 1 20
e01 2 21
e01 3 22
e01 4 23
e01 5 24
e01 6 25
e01 7 26
e01 8 27
e02 . .
e02 . .
I have to split data in to two groups based on itr ie itr 1-4 in one group and itr 5-8 in oter group
Then I have to calculate t-test on this two groups:
My current code is:
data_top4=data.groupby('exp').head(4)
data_bottom4=data.groupby('exp').tail(4)
tt_df.groupby('exp').apply(lambda df:
stats.ttest_ind(data.groupby('exp').head(4), data.groupby('exp').tail(4)
[0])
It doesn't function properly and has errors!