0

I performed a t-test on my dataframe and want to access the p-values from the t-test results. Some have suggested to use .summary of the t-test results shown below:

cat1 = df[df['Drug']=='Drug A']
cat2 = df[df['Drug']=='Drug B']
results = ttest_ind(cat1['intake'], cat2['intake'])
pvals = results.summary()

But i get this error:

AttributeError: 'Ttest_indResult' object has no attribute 'summary'

How can I fix this?

  • 1
    ```results``` can be accessed like a tuple. ```results[0]``` is what you want. See the return type from documentation. https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.ttest_ind.html – sin tribu Dec 07 '21 at 01:54
  • Thank you! I can access the output now. Not sure how I can set your comment as the answer to this question –  Dec 07 '21 at 02:42

0 Answers0