code: def test_pivot_table(self):
      pdf = pd.DataFrame(
          {
              "a": [4, 2, 3, 4, 8, 6],
              "b": [1, 2, 2, 4, 2, 4],
              "e": [10, 20, 20, 40, 20, 40],
              "c": [1, 2, 9, 4, 7, 4],
              "d": [-1, -2, -3, -4, -5, -6],
          },
          index=np.random.rand(6),
      )
      psdf = ps.from_pandas(pdf)
  
      columns = pd.MultiIndex.from_tuples(
          [("x", "a"), ("x", "b"), ("y", "e"), ("z", "c"), ("w", "d")]
      )
      pdf.columns = columns
      psdf.columns = columns
  
      self.assert_eq(
          psdf.pivot_table(
              index=[("z", "c")],
              columns=("x", "a"),
              values=[("x", "b"), ("y", "e"), ("w", "d")],
          ).sort_index(),
          pdf.pivot_table(
              index=[("z", "c")],
              columns=[("x", "a")],
              values=[("x", "b"), ("y", "e"), ("w", "d")],
          ).sort_index(),
          almost=True,
      )
  
      self.assert_eq(
          psdf.pivot_table(
              index=[("z", "c")],
              columns=("x", "a"),
              values=[("x", "b"), ("y", "e")],
              aggfunc={("x", "b"): "mean", ("y", "e"): "sum"},
          ).sort_index(),
          pdf.pivot_table(
              index=[("z", "c")],
              columns=[("x", "a")],
              values=[("x", "b"), ("y", "e")],
              aggfunc={("x", "b"): "mean", ("y", "e"): "sum"},
          ).sort_index(),
          almost=True,
      )
  
file_path: spark/python/pyspark/pandas/tests/computation/test_pivot_table_multi_idx_adv.py
imports: import unittest
  import numpy
  import pandas
  from pyspark import pandas
  from pyspark.testing.pandasutils import ComparisonTestBase
  from pyspark.testing.sqlutils import SQLTestUtils
label_desc: Use image node_id 1 for calling the PivotTableMultiIdxAdvMixin obj's underlying member method code with example usage: obj.test_pivot_table() without return types