code: def test_apply(self):
      pdf = pd.DataFrame(
          {
              "a": [1, 2, 3, 4, 5, 6] * 100,
              "b": [1.0, 1.0, 2.0, 3.0, 5.0, 8.0] * 100,
              "c": [1, 4, 9, 16, 25, 36] * 100,
          },
          columns=["a", "b", "c"],
          index=np.random.rand(600),
      )
      psdf = ps.DataFrame(pdf)
  
      self.assert_eq(
          psdf.apply(lambda x: x + 1).sort_index(),
          pdf.apply(lambda x: x + 1).sort_index(),
      )
      self.assert_eq(
          psdf.apply(lambda x, b: x + b, args=(1,)).sort_index(),
          pdf.apply(lambda x, b: x + b, args=(1,)).sort_index(),
      )
      self.assert_eq(
          psdf.apply(lambda x, b: x + b, b=1).sort_index(),
          pdf.apply(lambda x, b: x + b, b=1).sort_index(),
      )
  
      with option_context("compute.shortcut_limit", 500):
          self.assert_eq(
              psdf.apply(lambda x: x + 1).sort_index(),
              pdf.apply(lambda x: x + 1).sort_index(),
          )
          self.assert_eq(
              psdf.apply(lambda x, b: x + b, args=(1,)).sort_index(),
              pdf.apply(lambda x, b: x + b, args=(1,)).sort_index(),
          )
          self.assert_eq(
              psdf.apply(lambda x, b: x + b, b=1).sort_index(),
              pdf.apply(lambda x, b: x + b, b=1).sort_index(),
          )
  
      # returning a Series
      self.assert_eq(
          psdf.apply(lambda x: len(x), axis=1).sort_index(),
          pdf.apply(lambda x: len(x), axis=1).sort_index(),
      )
      self.assert_eq(
          psdf.apply(
              lambda x, c: len(x) + c, axis=1, c=100
          ).sort_index(),
          pdf.apply(
              lambda x, c: len(x) + c, axis=1, c=100
          ).sort_index(),
      )
      with option_context("compute.shortcut_limit", 500):
          self.assert_eq(
              psdf.apply(lambda x: len(x), axis=1).sort_index(),
              pdf.apply(lambda x: len(x), axis=1).sort_index(),
          )
          self.assert_eq(
              psdf.apply(
                  lambda x, c: len(x) + c, axis=1, c=100
              ).sort_index(),
              pdf.apply(
                  lambda x, c: len(x) + c, axis=1, c=100
              ).sort_index(),
          )
  
      with self.assertRaisesRegex(
          AssertionError, "the first argument should be a callable"
      ):
          psdf.apply(1)
  
      with self.assertRaisesRegex(
          TypeError, "The given function.*1 or 'column'; however"
      ):
  
          def f1(_) -> ps.DataFrame[int]:
              pass
  
          psdf.apply(f1, axis=0)
  
      with self.assertRaisesRegex(
          TypeError, "The given function.*0 or 'index'; however"
      ):
  
          def f2(_) -> ps.Series[int]:
              pass
  
          psdf.apply(f2, axis=1)
  
      # multi-index columns
      columns = pd.MultiIndex.from_tuples(
          [("x", "a"), ("x", "b"), ("y", "c")]
      )
      pdf.columns = columns
      psdf.columns = columns
  
      self.assert_eq(
          psdf.apply(lambda x: x + 1).sort_index(),
          pdf.apply(lambda x: x + 1).sort_index(),
      )
      with option_context("compute.shortcut_limit", 500):
          self.assert_eq(
              psdf.apply(lambda x: x + 1).sort_index(),
              pdf.apply(lambda x: x + 1).sort_index(),
          )
  
      # returning a Series
      self.assert_eq(
          psdf.apply(lambda x: len(x), axis=1).sort_index(),
          pdf.apply(lambda x: len(x), axis=1).sort_index(),
      )
      with option_context("compute.shortcut_limit", 500):
          self.assert_eq(
              psdf.apply(lambda x: len(x), axis=1).sort_index(),
              pdf.apply(lambda x: len(x), axis=1).sort_index(),
          )
  
imports: from datetime import datetime
  import sys
  import unittest
  from typing import List
  import numpy
  import pandas
  from pyspark import pandas
  from pyspark.loose_version import LooseVersion
  from pyspark.pandas.config import option_context
  from pyspark.testing.pandasutils import ComparisonTestBase
  from pyspark.testing.sqlutils import SQLTestUtils
label_desc: Use image node_id 2 for calling the FrameApplyFunctionMixin obj's underlying member method code with example usage: obj.test_apply() without return types