def _table_proportion(count, nobs):
 table = np.column_stack((count, (nobs - count)))
 expected = (((table.sum(0) * table.sum(1)[:, None]) * 1.0) / table.sum())
 n_rows = table.shape[0]
 return (table, expected, n_rows)

def _table_proportion ( count , nobs ) : table = np . column_stack ( ( count , ( nobs - count ) ) ) expected = ( ( ( table . sum ( 0 ) * table . sum ( 1 ) [ : , None ] ) * 1.0 ) / table . sum ( ) ) n_rows = table . shape [ 0 ] return ( table , expected , n_rows )
create a k by 2 contingency table for proportion helper function for proportions_chisquare parameters count : integer or array_like the number of successes in nobs trials .