code: def test_cumcount(self):
      pdf = pd.DataFrame(
          {
              "a": [1, 2, 3, 4, 5, 6] * 3,
              "b": [1, 1, 2, 3, 5, 8] * 3,
              "c": [1, 4, 9, 16, 25, 36] * 3,
          },
          index=np.random.rand(6 * 3),
      )
      psdf = ps.from_pandas(pdf)
  
      for ascending in [True, False]:
          self.assert_eq(
              psdf.groupby("b")
              .cumcount(ascending=ascending)
              .sort_index(),
              pdf.groupby("b")
              .cumcount(ascending=ascending)
              .sort_index(),
          )
          self.assert_eq(
              psdf.groupby(["a", "b"])
              .cumcount(ascending=ascending)
              .sort_index(),
              pdf.groupby(["a", "b"])
              .cumcount(ascending=ascending)
              .sort_index(),
          )
          self.assert_eq(
              psdf.groupby(["b"])["a"]
              .cumcount(ascending=ascending)
              .sort_index(),
              pdf.groupby(["b"])["a"]
              .cumcount(ascending=ascending)
              .sort_index(),
          )
          self.assert_eq(
              psdf.groupby(["b"])[["a", "c"]]
              .cumcount(ascending=ascending)
              .sort_index(),
              pdf.groupby(["b"])[["a", "c"]]
              .cumcount(ascending=ascending)
              .sort_index(),
          )
          self.assert_eq(
              psdf.groupby(psdf.b // 5)
              .cumcount(ascending=ascending)
              .sort_index(),
              pdf.groupby(pdf.b // 5)
              .cumcount(ascending=ascending)
              .sort_index(),
          )
          self.assert_eq(
              psdf.groupby(psdf.b // 5)["a"]
              .cumcount(ascending=ascending)
              .sort_index(),
              pdf.groupby(pdf.b // 5)["a"]
              .cumcount(ascending=ascending)
              .sort_index(),
          )
          self.assert_eq(
              psdf.groupby("b").cumcount(ascending=ascending).sum(),
              pdf.groupby("b").cumcount(ascending=ascending).sum(),
          )
          self.assert_eq(
              psdf.a.rename()
              .groupby(psdf.b)
              .cumcount(ascending=ascending)
              .sort_index(),
              pdf.a.rename()
              .groupby(pdf.b)
              .cumcount(ascending=ascending)
              .sort_index(),
          )
          self.assert_eq(
              psdf.a.groupby(psdf.b.rename())
              .cumcount(ascending=ascending)
              .sort_index(),
              pdf.a.groupby(pdf.b.rename())
              .cumcount(ascending=ascending)
              .sort_index(),
          )
          self.assert_eq(
              psdf.a.rename()
              .groupby(psdf.b.rename())
              .cumcount(ascending=ascending)
              .sort_index(),
              pdf.a.rename()
              .groupby(pdf.b.rename())
              .cumcount(ascending=ascending)
              .sort_index(),
          )
  
      # multi-index columns
      columns = pd.MultiIndex.from_tuples(
          [("x", "a"), ("x", "b"), ("y", "c")]
      )
      pdf.columns = columns
      psdf.columns = columns
  
      for ascending in [True, False]:
          self.assert_eq(
              psdf.groupby(("x", "b"))
              .cumcount(ascending=ascending)
              .sort_index(),
              pdf.groupby(("x", "b"))
              .cumcount(ascending=ascending)
              .sort_index(),
          )
          self.assert_eq(
              psdf.groupby([("x", "a"), ("x", "b")])
              .cumcount(ascending=ascending)
              .sort_index(),
              pdf.groupby([("x", "a"), ("x", "b")])
              .cumcount(ascending=ascending)
              .sort_index(),
          )
  
file_path: spark/python/pyspark/pandas/tests/groupby/test_cumulative.py
imports: import unittest
  import numpy
  import pandas
  from pyspark import pandas
  from pyspark.pandas.exceptions import DataError
  from pyspark.testing.pandasutils import ComparisonTestBase
  from pyspark.testing.sqlutils import SQLTestUtils
label_desc: Use image node_id 1 for calling the GroupbyCumulativeMixin obj's underlying member method code with example usage: obj.test_cumcount() without return types