def proportions_chisquare(count, nobs, value=None):
 nobs = np.atleast_1d(nobs)
 (table, expected, n_rows) = _table_proportion(count, nobs)
 if (value is not None):
  expected = np.column_stack(((nobs * value), (nobs * (1 - value))))
  ddof = (n_rows - 1)
 else:
  ddof = n_rows
 (chi2stat, pval) = stats.chisquare(table.ravel(), expected.ravel(), ddof=ddof)
 return (chi2stat, pval, (table, expected))

def proportions_chisquare ( count , nobs , value = None ) : nobs = np . atleast_1d ( nobs ) ( table , expected , n_rows ) = _table_proportion ( count , nobs ) if ( value is not None ) : expected = np . column_stack ( ( ( nobs * value ) , ( nobs * ( 1 - value ) ) ) ) ddof = ( n_rows - 1 ) else : ddof = n_rows ( chi2stat , pval ) = stats . chisquare ( table . ravel ( ) , expected . ravel ( ) , ddof = ddof ) return ( chi2stat , pval , ( table , expected ) )
test for proportions based on chisquare test parameters count : integer or array_like the number of successes in nobs trials .