code: def test_duplicated(self):
      pdf = pd.DataFrame(
          {"a": [1, 1, 2, 3], "b": [1, 1, 1, 4], "c": [1, 1, 1, 5]},
          index=np.random.rand(4),
      )
      psdf = ps.from_pandas(pdf)
  
      self.assert_eq(
          pdf.duplicated().sort_index(), psdf.duplicated().sort_index()
      )
      self.assert_eq(
          pdf.duplicated(keep="last").sort_index(),
          psdf.duplicated(keep="last").sort_index(),
      )
      self.assert_eq(
          pdf.duplicated(keep=False).sort_index(),
          psdf.duplicated(keep=False).sort_index(),
      )
      self.assert_eq(
          pdf.duplicated(subset="b").sort_index(),
          psdf.duplicated(subset="b").sort_index(),
      )
      self.assert_eq(
          pdf.duplicated(subset=["b"]).sort_index(),
          psdf.duplicated(subset=["b"]).sort_index(),
      )
      with self.assertRaisesRegex(
          ValueError, "'keep' only supports 'first', 'last' and False"
      ):
          psdf.duplicated(keep="false")
      with self.assertRaisesRegex(KeyError, "'d'"):
          psdf.duplicated(subset=["d"])
  
      pdf.index.name = "x"
      psdf.index.name = "x"
      self.assert_eq(
          pdf.duplicated().sort_index(), psdf.duplicated().sort_index()
      )
  
      # multi-index
      self.assert_eq(
          pdf.set_index("a", append=True).duplicated().sort_index(),
          psdf.set_index("a", append=True).duplicated().sort_index(),
      )
      self.assert_eq(
          pdf.set_index("a", append=True)
          .duplicated(keep=False)
          .sort_index(),
          psdf.set_index("a", append=True)
          .duplicated(keep=False)
          .sort_index(),
      )
      self.assert_eq(
          pdf.set_index("a", append=True)
          .duplicated(subset=["b"])
          .sort_index(),
          psdf.set_index("a", append=True)
          .duplicated(subset=["b"])
          .sort_index(),
      )
  
      # mutli-index columns
      columns = pd.MultiIndex.from_tuples(
          [("x", "a"), ("x", "b"), ("y", "c")]
      )
      pdf.columns = columns
      psdf.columns = columns
      self.assert_eq(
          pdf.duplicated().sort_index(), psdf.duplicated().sort_index()
      )
      self.assert_eq(
          pdf.duplicated(subset=("x", "b")).sort_index(),
          psdf.duplicated(subset=("x", "b")).sort_index(),
      )
      self.assert_eq(
          pdf.duplicated(subset=[("x", "b")]).sort_index(),
          psdf.duplicated(subset=[("x", "b")]).sort_index(),
      )
  
      # non-string names
      pdf = pd.DataFrame(
          {10: [1, 1, 2, 3], 20: [1, 1, 1, 4], 30: [1, 1, 1, 5]},
          index=np.random.rand(4),
      )
      psdf = ps.from_pandas(pdf)
  
      self.assert_eq(
          pdf.duplicated().sort_index(), psdf.duplicated().sort_index()
      )
      self.assert_eq(
          pdf.duplicated(subset=10).sort_index(),
          psdf.duplicated(subset=10).sort_index(),
      )
  
imports: import unittest
  import numpy
  import pandas
  from pandas.tseries.offsets import DateOffset
  from pyspark import pandas
  from pyspark.errors import PySparkValueError
  from pyspark.pandas.config import option_context
  from pyspark.testing.pandasutils import ComparisonTestBase
  from pyspark.testing.sqlutils import SQLTestUtils
label_desc: Use image node_id 8 for calling the FrameReindexingMixin obj's underlying member method code with example usage: obj.test_duplicated() without return types