code: def H2OFrame_from_scipy():
      from scipy.sparse import csr_matrix, csc_matrix
  
      nostr_data = [
          [0 if isinstance(v, str) else v for v in r] for r in data
      ]
  
      def check_sparse_frame(fr, dest):
          assert fr.key == dest
          assert fr.nrows == len(nostr_data)
          assert fr.ncols == len(nostr_data[0])
          assert fr.columns == [
              "C%i" % i for i in range(1, fr.ncols + 1)
          ]  # BUG! construction with scipy matrix ignores `column_names` param: see issue https://github.com/h2oai/h2o-3/issues/15946
          assert fr.types == dict(
              C1="int", C2="real", C3="int", C4="int"
          )  # enum types are also ignored, but it makes sense for sparse matrices, we could add a warning though.
          for i, row in enumerate(data):
              for j, value in enumerate(row):
                  assert (
                      fr[i, j] == nostr_data[i][j]
                  ), "expected value at [%s, %s] = %s, but got %s" % (
                      i,
                      j,
                      fr[i, j],
                      nostr_data[i][j],
                  )
  
      fr = h2o.H2OFrame(
          csr_matrix(nostr_data),
          destination_frame="from_sparse_row_matrix",
          column_names=col_names,
          column_types=col_types,
      )
      assert_is_type(fr, H2OFrame)
      print(fr)
      check_sparse_frame(fr, "from_sparse_row_matrix")
  
      fr = h2o.H2OFrame(
          csc_matrix(nostr_data),
          destination_frame="from_sparse_column_matrix",
          column_names=col_names,
          column_types=col_types,
      )
      assert_is_type(fr, H2OFrame)
      check_sparse_frame(fr, "from_sparse_column_matrix")
  
file_path: h2o-3/h2o-py/tests/testdir_apis/Data_Manipulation/pyunit_h2oH2OFrame.py
imports: import sys
  from tests import pyunit_utils
  import h2o
  from h2o.utils.typechecks import assert_is_type
  from h2o.frame import H2OFrame
label_desc: Use image node_id 7 for calling a global function with example usage: H2OFrame_from_scipy() without return types