code: def test_stack_execution(setup):
      raw = pd.DataFrame(
          np.random.rand(10, 3),
          columns=list("abc"),
          index=[f"s{i}" for i in range(10)],
      )
      for loc in [(5, 1), (8, 2), (1, 0)]:
          raw.iloc[loc] = np.nan
      df = from_pandas_df(raw, chunk_size=(5, 2))
  
      for dropna in (True, False):
          r = df.stack(dropna=dropna)
          result = r.execute().fetch()
          expected = raw.stack(dropna=dropna)
          pd.testing.assert_series_equal(result, expected)
  
      cols = pd.MultiIndex.from_tuples(
          [("c1", "cc1"), ("c1", "cc2"), ("c2", "cc3")]
      )
      raw2 = raw.copy()
      raw2.columns = cols
      df = from_pandas_df(raw2, chunk_size=(5, 2))
  
      for level in [-1, 0, [0, 1]]:
          for dropna in (True, False):
              r = df.stack(level=level, dropna=dropna)
              result = r.execute().fetch()
              expected = raw2.stack(level=level, dropna=dropna)
              assert_method = (
                  pd.testing.assert_series_equal
                  if expected.ndim == 1
                  else pd.testing.assert_frame_equal
              )
              assert_method(result, expected)
  
imports: import random
  from collections import OrderedDict
  import numpy
  import pandas
  import pytest
  import mars
  from ....config import options, option_context
  from ....dataframe import DataFrame, Series
  from ....tensor import arange, tensor
  from ....tensor.random import rand
  from ....tests.core import require_cudf
  from ....utils import lazy_import, pd_release_version, no_default
  from ...None import eval, cut, qcut, get_dummies
  from ...core import DATAFRAME_OR_SERIES_TYPE
  from ...datasource.dataframe import from_pandas
  from ...datasource.series import from_pandas
  from ...datasource.index import from_pandas
  from ..None import to_gpu, to_cpu
  from ..bloom_filter import filter_by_bloom_filter
  from ..shift import _enable_no_default, _with_column_freq_bug
  from ..to_numeric import to_numeric
  from ..rebalance import DataFrameRebalance
label_desc: Use image node_id 40 for calling a global function with example usage: test_stack_execution(setup) without return types