hypothesis-test

T-test in Pandas

会有一股神秘感。 提交于 2019-11-28 16:04:25
If I want to calculate the mean of two categories in Pandas, I can do it like this: data = {'Category': ['cat2','cat1','cat2','cat1','cat2','cat1','cat2','cat1','cat1','cat1','cat2'], 'values': [1,2,3,1,2,3,1,2,3,5,1]} my_data = DataFrame(data) my_data.groupby('Category').mean() Category: values: cat1 2.666667 cat2 1.600000 I have a lot of data formatted this way, and now I need to do a T -test to see if the mean of cat1 and cat2 are statistically different. How can I do that? it depends what sort of t-test you want to do (one sided or two sided dependent or independent) but it should be as

T-test in Pandas

孤人 提交于 2019-11-26 18:59:27
问题 If I want to calculate the mean of two categories in Pandas, I can do it like this: data = {'Category': ['cat2','cat1','cat2','cat1','cat2','cat1','cat2','cat1','cat1','cat1','cat2'], 'values': [1,2,3,1,2,3,1,2,3,5,1]} my_data = DataFrame(data) my_data.groupby('Category').mean() Category: values: cat1 2.666667 cat2 1.600000 I have a lot of data formatted this way, and now I need to do a T -test to see if the mean of cat1 and cat2 are statistically different. How can I do that? 回答1: it depends