code: def hmine(
      df, min_support=0.5, use_colnames=False, max_len=None, verbose=0
  ) -> pd.DataFrame:
      """
      Get frequent itemsets from a one-hot DataFrame
  
      Parameters
      -----------
      df : pandas DataFrame
        pandas DataFrame the encoded format. Also supports
        DataFrames with sparse data; for more info, please
        see https://pandas.pydata.org/pandas-docs/stable/user_guide/sparse.html#sparse-data-structures.
  
        Please note that the old pandas SparseDataFrame format
        is no longer supported in mlxtend >= 0.17.2.
  
        The allowed values are either 0/1 or True/False.
        For example,
  
      ```
             Apple  Bananas   Beer  Chicken   Milk   Rice
          0   True    False   True     True  False   True
          1   True    False   True    False  False   True
          2   True    False   True    False  False  False
          3   True     True  False    False  False  False
          4  False    False   True     True   True   True
          5  False    False   True    False   True   True
          6  False    False   True    False   True  False
          7   True     True  False    False  False  False
      ```
  
      min_support : float (default: 0.5)
        A float between 0 and 1 for minimum support of the itemsets returned.
        The support is computed as the fraction
        transactions_where_item(s)_occur / total_transactions.
  
      use_colnames : bool (default: False)
        If true, uses the DataFrames' column names in the returned DataFrame
        instead of column indices.
  
      max_len : int (default: None)
        Maximum length of the itemsets generated. If `None` (default) all
        possible itemsets lengths are evaluated.
  
      verbose : int (default: 0)
        Shows the stages of conditional tree generation.
  
      Returns
      -----------
      pandas DataFrame with columns ['support', 'itemsets'] of all itemsets
        that are >= `min_support` and < than `max_len`
        (if `max_len` is not None).
        Each itemset in the 'itemsets' column is of type `frozenset`,
        which is a Python built-in type that behaves similarly to
        sets except that it is immutable
        (For more info, see
        https://docs.python.org/3.6/library/stdtypes.html#frozenset).
  
      Examples
      ----------
      For usage examples, please see
      https://rasbt.github.io/mlxtend/user_guide/frequent_patterns/hmine/
  
      """
  
      fpc.valid_input_check(df)
      if min_support <= 0.0:
          raise ValueError(
              "`min_support` must be a positive "
              "number within the interval `(0, 1]`. "
              "Got %s." % min_support
          )
      # Calculate the minimum support based on the number of transactions (absolute support)
      minsup = math.ceil(min_support * len(df))
  
      is_sparse = False
      if hasattr(df, "sparse"):
          # DataFrame with SparseArray (pandas >= 0.24)
          if df.size == 0:
              itemsets = df.values
          else:
              itemsets = df.sparse.to_coo().tocsr()
              is_sparse = True
      else:
          # dense DataFrame
          itemsets = df.values
      if is_sparse:
          is_sparse
      single_items = np.array(df.columns)
      itemsets_shape = itemsets.shape[0]
      (
          itemsets,
          single_items,
          single_items_support,
      ) = itemset_optimisation(itemsets, single_items, minsup)
      numeric_single_items = np.arange(len(single_items))
      frequent_itemsets = {}
      for item in numeric_single_items:
          if single_items_support[item] >= minsup:
              supp = single_items_support[item] / itemsets_shape
              frequent_itemsets[frozenset([single_items[item]])] = supp
          if max_len == 1:
              continue
          # Recursive call to find frequent itemsets
          frequent_itemsets = hmine_driver(
              [item],
              itemsets,
              minsup,
              itemsets_shape,
              max_len,
              verbose,
              single_items,
              frequent_itemsets,
          )
      # Convert the dictionary to a DataFrame
      res_df = pd.DataFrame(
          [frequent_itemsets.values(), frequent_itemsets.keys()]
      ).T
      res_df.columns = ["support", "itemsets"]
  
      if not use_colnames:
          mapping = {item: idx for idx, item in enumerate(df.columns)}
          res_df["itemsets"] = res_df["itemsets"].apply(
              lambda x: frozenset([mapping[i] for i in x])
          )
  
      return res_df
  
imports: import math
  import numpy
  import pandas
  from ..frequent_patterns import fpcommon
label_desc: Use image node_id 1 for calling a global function with example usage: hmine(df, min_support, use_colnames, max_len, verbose) and returns: res_df