Getting different chi square values than sklearn function
I had a similar problem using Scipy's chi2_contingency. It turns out that the Scipy function uses by default correction=True, and the statistic you showed doesn't use the correction. Perhaps sklearn's chi2 uses the correction as well, and that's the reason you don't get the same results. I suggest trying Scipy's with both correction set to true and false to see if it matches the two results.