Search code examples
pythonnumpystatisticsp-valuet-test

How to perform two-sample unequal sized t-test for two np.array in python?


I have two numpy arrays with different sizes that I would like to run a t-test on directly in python to see the p-value.


Solution

  • You can use Scipy Library, you can install it using 'pip install scipy'

    from scipy import stats
    print(stats.ttest_ind(arr1, arr2))
    

    It returns tuple of calculated t-statistic and two-tailed p-value

    Reference Documentation