code: def test_idxmax(self):
      pdf = pd.DataFrame(
          {
              "a": [1, 1, 2, 2, 3] * 3,
              "b": [1, 2, 3, 4, 5] * 3,
              "c": [5, 4, 3, 2, 1] * 3,
          }
      )
      psdf = ps.from_pandas(pdf)
  
      self.assert_eq(
          pdf.groupby(["a"]).idxmax().sort_index(),
          psdf.groupby(["a"]).idxmax().sort_index(),
      )
      self.assert_eq(
          pdf.groupby(["a"]).idxmax(skipna=False).sort_index(),
          psdf.groupby(["a"]).idxmax(skipna=False).sort_index(),
      )
      self.assert_eq(
          pdf.groupby(["a"])["b"].idxmax().sort_index(),
          psdf.groupby(["a"])["b"].idxmax().sort_index(),
      )
      self.assert_eq(
          pdf.b.rename().groupby(pdf.a).idxmax().sort_index(),
          psdf.b.rename().groupby(psdf.a).idxmax().sort_index(),
      )
      self.assert_eq(
          pdf.b.groupby(pdf.a.rename()).idxmax().sort_index(),
          psdf.b.groupby(psdf.a.rename()).idxmax().sort_index(),
      )
      self.assert_eq(
          pdf.b.rename().groupby(pdf.a.rename()).idxmax().sort_index(),
          psdf.b.rename()
          .groupby(psdf.a.rename())
          .idxmax()
          .sort_index(),
      )
  
      with self.assertRaisesRegex(
          ValueError, "idxmax only support one-level index now"
      ):
          psdf.set_index(["a", "b"]).groupby(["c"]).idxmax()
  
      # multi-index columns
      columns = pd.MultiIndex.from_tuples(
          [("x", "a"), ("x", "b"), ("y", "c")]
      )
      pdf.columns = columns
      psdf.columns = columns
  
      self.assert_eq(
          pdf.groupby(("x", "a")).idxmax().sort_index(),
          psdf.groupby(("x", "a")).idxmax().sort_index(),
      )
      self.assert_eq(
          pdf.groupby(("x", "a")).idxmax(skipna=False).sort_index(),
          psdf.groupby(("x", "a")).idxmax(skipna=False).sort_index(),
      )
  
file_path: spark/python/pyspark/pandas/tests/groupby/test_index.py
imports: import unittest
  import pandas
  from pyspark import pandas
  from pyspark.testing.pandasutils import ComparisonTestBase
  from pyspark.testing.sqlutils import SQLTestUtils
label_desc: Use image node_id 2 for calling the GroupbyIndexMixin obj's underlying member method code with example usage: obj.test_idxmax() without return types