I have computed a test statistic that is distributed as a chi square with 1 degree of freedom, and want to find out what P-value this corresponds to using python.
I
Some of the other solutions are deprecated. Use scipy.stats.chi2 Survival Function. Which is the same as 1 - cdf(chi_statistic, df)
scipy.stats.chi2
1 - cdf(chi_statistic, df)
Example:
from scipy.stats import chi2 p_value = chi2.sf(chi_statistic, df)