code: def test_aggregate_relabel(self):
      # this is to test named aggregation in groupby
      pdf = pd.DataFrame(
          {
              "group": ["a", "a", "b", "b"],
              "A": [0, 1, 2, 3],
              "B": [5, 6, 7, 8],
          }
      )
      psdf = ps.from_pandas(pdf)
  
      # different agg column, same function
      agg_pdf = (
          pdf.groupby("group")
          .agg(a_max=("A", "max"), b_max=("B", "max"))
          .sort_index()
      )
      agg_psdf = (
          psdf.groupby("group")
          .agg(a_max=("A", "max"), b_max=("B", "max"))
          .sort_index()
      )
      self.assert_eq(agg_pdf, agg_psdf)
  
      # same agg column, different functions
      agg_pdf = (
          pdf.groupby("group")
          .agg(b_max=("B", "max"), b_min=("B", "min"))
          .sort_index()
      )
      agg_psdf = (
          psdf.groupby("group")
          .agg(b_max=("B", "max"), b_min=("B", "min"))
          .sort_index()
      )
      self.assert_eq(agg_pdf, agg_psdf)
  
      # test on NamedAgg
      agg_pdf = (
          pdf.groupby("group")
          .agg(b_max=pd.NamedAgg(column="B", aggfunc="max"))
          .sort_index()
      )
      agg_psdf = (
          psdf.groupby("group")
          .agg(b_max=ps.NamedAgg(column="B", aggfunc="max"))
          .sort_index()
      )
      self.assert_eq(agg_psdf, agg_pdf)
  
      # test on NamedAgg multi columns aggregation
      agg_pdf = (
          pdf.groupby("group")
          .agg(
              b_max=pd.NamedAgg(column="B", aggfunc="max"),
              b_min=pd.NamedAgg(column="B", aggfunc="min"),
          )
          .sort_index()
      )
      agg_psdf = (
          psdf.groupby("group")
          .agg(
              b_max=ps.NamedAgg(column="B", aggfunc="max"),
              b_min=ps.NamedAgg(column="B", aggfunc="min"),
          )
          .sort_index()
      )
      self.assert_eq(agg_psdf, agg_pdf)
  
file_path: spark/python/pyspark/pandas/tests/groupby/test_aggregate.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 3 for calling the GroupbyAggregateMixin obj's underlying member method code with example usage: obj.test_aggregate_relabel() without return types