class_docstr: Base class for testing frequent pattern mining on a small example.
class_docstr_tok: ["Base","class","for","testing","frequent","pattern","mining","on","a","small","example","."]
code: def test_sparse_with_zero(self):
      if Version(pandas_version) < Version("1.2"):
          # needs to be revisited in future when pandas bug
          # in https://github.com/pandas-dev/pandas/issues/29814
          # is fixed
          return
      res_df = self.fpalgo(self.df)
      ary2 = self.one_ary.copy()
      ary2[3, :] = 1
      sparse_ary = csr_matrix(ary2)
      sparse_ary[3, :] = self.one_ary[3, :]
  
      sdf = pd.DataFrame.sparse.from_spmatrix(
          sparse_ary, columns=self.df.columns
      )
      res_df2 = self.fpalgo(sdf)
      compare_dataframes(res_df2, res_df)
  
imports: import sys
  from contextlib import contextmanager
  from io import StringIO
  import numpy
  import pandas
  from numpy.testing import assert_array_equal
  from packaging.version import Version
  from pandas import __version__
  from scipy.sparse import csr_matrix
  from mlxtend.preprocessing import TransactionEncoder
  from mlxtend.utils import assert_raises
label_desc: Use image node_id 4 for calling the FPTestEx1 obj's underlying member method code with example usage: obj.test_sparse_with_zero() without return types