code: def test_from_data_stratified():
      df = pd.DataFrame(
          [
              [1, 1, 1, 0, 1, 0, 1, 0],
              [0, 1, 0, 1, 0, 1, 0, 0],
              [0, 0, 0, 0, 1, 1, 1, 1],
          ]
      ).T
      e = np.asarray([[[0, 1], [1, 1]], [[2, 2], [1, 0]]])
  
      # Test pandas
      tab1 = ctab.StratifiedTable.from_data(0, 1, 2, df)
      assert_equal(tab1.table, e)
  
      # Test ndarray
      tab1 = ctab.StratifiedTable.from_data(0, 1, 2, np.asarray(df))
      assert_equal(tab1.table, e)
  
imports: import os
  import warnings
  import numpy
  import statsmodels.stats.contingency_tables
  import pandas
  from numpy.testing import assert_allclose, assert_equal
  import statsmodels.api
label_desc: Use image node_id 13 for calling a global function with example usage: test_from_data_stratified() without return types