I am using
scipy.stats.chi2.ppf in python to convert GWAS p-values into chi-squared statistics. As I am interested in the upper tail, I insert 1-p in the method.
The method works generally well. However, for very small p-values (e.g. 3.760e-18) and 1 df, the method returns
>>> scipy.stats.chi2.ppf(1-3.760e-18, 1) inf
On the other hand, R's
qchisq function takes care of this problem with the
> qchisq(3.760e-18, 1, lower.tail=F)  75.44357
> qchisq(1-3.760e-18, 1)  Inf
Is there a way to make the python method behave like the R function?