code: def test_mode(self):
      pdf = pd.DataFrame(
          {
              "A": [1, 2, None, 4, 5, 4, 2],
              "B": [-0.1, 0.2, -0.3, np.nan, 0.5, -0.1, -0.1],
              "C": ["d", "b", "c", "c", "e", "a", "a"],
              "D": [np.nan, np.nan, np.nan, np.nan, 0.1, -0.1, -0.1],
              "E": [
                  np.nan,
                  np.nan,
                  np.nan,
                  np.nan,
                  np.nan,
                  np.nan,
                  np.nan,
              ],
          }
      )
      psdf = ps.from_pandas(pdf)
  
      self.assert_eq(psdf.mode(), pdf.mode())
      self.assert_eq(
          psdf.mode(numeric_only=True), pdf.mode(numeric_only=True)
      )
      self.assert_eq(psdf.mode(dropna=False), pdf.mode(dropna=False))
  
      # dataframe with single column
      for c in ["A", "B", "C", "D", "E"]:
          self.assert_eq(psdf[[c]].mode(), pdf[[c]].mode())
  
      with self.assertRaises(ValueError):
          psdf.mode(axis=2)
  
      def func(iterator):
          for pdf in iterator:
              if len(pdf) > 0:
                  if pdf["partition"][0] == 3:
                      yield pd.DataFrame(
                          {
                              "num": [
                                  "3",
                                  "3",
                                  "3",
                                  "3",
                                  "4",
                              ]
                          }
                      )
                  else:
                      yield pd.DataFrame(
                          {
                              "num": [
                                  "0",
                                  "1",
                                  "2",
                                  "3",
                                  "4",
                              ]
                          }
                      )
  
      df = (
          self.spark.range(0, 4, 1, 4)
          .select(sf.spark_partition_id().alias("partition"))
          .mapInPandas(func, "num string")
      )
  
      psdf = df.pandas_api()
      self.assert_eq(psdf.mode(), psdf._to_pandas().mode())
  
imports: import unittest
  import numpy
  import pandas
  from pyspark.sql import functions
  from pyspark import pandas
  from pyspark.testing.pandasutils import ComparisonTestBase
  from pyspark.testing.sqlutils import SQLTestUtils
label_desc: Use image node_id 5 for calling the FrameComputeMixin obj's underlying member method code with example usage: obj.test_mode() without return types