

def _chisquare(f_obs, f_exp):
    'Fast replacement for scipy.stats.chisquare.\n\n    Version from https://github.com/scipy/scipy/pull/2525 with additional\n    optimizations.\n    '
    f_obs = np.asarray(f_obs, dtype=np.float64)
    k = len(f_obs)
    chisq = f_obs
    chisq -= f_exp
    chisq **= 2
    chisq /= f_exp
    chisq = chisq.sum(axis=0)
    return (chisq, special.chdtrc((k - 1), chisq))

dataset/ETHPy150Open scikit-learn/scikit-learn/sklearn/feature_selection/univariate_selection.py _chisquare/original