code: def proportions_chisquare(count, nobs, value=None):
      """
      Test for proportions based on chisquare test
  
      Parameters
      ----------
      count : {int, array_like}
          the number of successes in nobs trials. If this is array_like, then
          the assumption is that this represents the number of successes for
          each independent sample
      nobs : int
          the number of trials or observations, with the same length as
          count.
      value : None or float or array_like
  
      Returns
      -------
      chi2stat : float
          test statistic for the chisquare test
      p-value : float
          p-value for the chisquare test
      (table, expected)
          table is a (k, 2) contingency table, ``expected`` is the corresponding
          table of counts that are expected under independence with given
          margins
  
      Notes
      -----
      Recent version of scipy.stats have a chisquare test for independence in
      contingency tables.
  
      This function provides a similar interface to chisquare tests as
      ``prop.test`` in R, however without the option for Yates continuity
      correction.
  
      count can be the count for the number of events for a single proportion,
      or the counts for several independent proportions. If value is given, then
      all proportions are jointly tested against this value. If value is not
      given and count and nobs are not scalar, then the null hypothesis is
      that all samples have the same proportion.
  
      """
      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
  
      # print table, expected
      chi2stat, pval = stats.chisquare(
          table.ravel(), expected.ravel(), ddof=ddof
      )
      return chi2stat, pval, (table, expected)
  
imports: from statsmodels.compat.python import lzip
  from typing import Callable
  import numpy
  import pandas
  from scipy import optimize, stats
  from statsmodels.stats.base import AllPairsResults, HolderTuple
  from statsmodels.stats.weightstats import _zstat_generic2
  from statsmodels.tools.sm_exceptions import HypothesisTestWarning
  from statsmodels.tools.testing import Holder
  from statsmodels.tools.validation import array_like
label_desc: Use image node_id 19 for calling a global function with example usage: proportions_chisquare(count, nobs, value) and returns: chi2stat,  pval,  table,  expected