code: def test_apply_with_skip_infer(setup):
      df = pd.DataFrame({"col1": [1, 2, 3, 4], "col2": list("abcd")})
      mdf = md.DataFrame(df, chunk_size=2)
  
      def apply_func(series):
          if series[1] not in "abcd":
              # make it fail when inferring
              raise TypeError
          else:
              return 1
  
      with pytest.raises(TypeError):
          mdf.apply(apply_func, axis=1)
  
      res = mdf.apply(apply_func, axis=1, skip_infer=True).execute()
      assert isinstance(res, DATAFRAME_OR_SERIES_TYPE)
      pd.testing.assert_series_equal(res.fetch(), pd.Series([1] * 4))
  
      s = pd.Series([1, 2, 3, 4])
      ms = md.Series(s, chunk_size=2)
  
      apply_func = lambda x: pd.Series([1, 2])
      res = ms.apply(apply_func, skip_infer=True).execute()
      assert isinstance(res, DATAFRAME_OR_SERIES_TYPE)
      pd.testing.assert_frame_equal(
          res.fetch(), pd.DataFrame([[1, 2]] * 4)
      )
  
file_path: mars/mars/dataframe/base/tests/test_apply_execution.py
imports: import numpy
  import pandas
  import pytest
  from ....None import dataframe
  from ....dataframe.core import DataFrame, DATAFRAME_OR_SERIES_TYPE
  from ....dataframe.fetch.core import DataFrameFetch
label_desc: Use image node_id 2 for calling a global function with example usage: test_apply_with_skip_infer(setup) and returns: int