code: def test_multiindex_droplevel(self):
      pidx = pd.MultiIndex.from_tuples(
          [("a", "x", 1), ("b", "y", 2)],
          names=["level1", "level2", "level3"],
      )
      psidx = ps.from_pandas(pidx)
      with self.assertRaisesRegex(
          IndexError, "Too many levels: Index has only 3 levels, not 5"
      ):
          psidx.droplevel(4)
  
      with self.assertRaisesRegex(KeyError, "Level level4 not found"):
          psidx.droplevel("level4")
  
      with self.assertRaisesRegex(
          KeyError, "Level.*level3.*level4.*not found"
      ):
          psidx.droplevel([("level3", "level4")])
  
      with self.assertRaisesRegex(
          ValueError,
          "Cannot remove 4 levels from an index with 3 levels: at least one "
          "level must be left.",
      ):
          psidx.droplevel([0, 0, 1, 2])
  
      with self.assertRaisesRegex(
          ValueError,
          "Cannot remove 3 levels from an index with 3 levels: at least one "
          "level must be left.",
      ):
          psidx.droplevel([0, 1, 2])
  
      self.assert_eq(pidx.droplevel(0), psidx.droplevel(0))
      self.assert_eq(pidx.droplevel([0, 1]), psidx.droplevel([0, 1]))
      self.assert_eq(pidx.droplevel((0, 1)), psidx.droplevel((0, 1)))
      self.assert_eq(
          pidx.droplevel([0, "level2"]), psidx.droplevel([0, "level2"])
      )
      self.assert_eq(
          pidx.droplevel((0, "level2")), psidx.droplevel((0, "level2"))
      )
  
      # non-string names
      pidx = pd.MultiIndex.from_tuples(
          [("a", "x", 1), ("b", "y", 2)], names=[1.0, 2.0, 3.0]
      )
      psidx = ps.from_pandas(pidx)
      self.assert_eq(pidx.droplevel(1.0), psidx.droplevel(1.0))
      self.assert_eq(
          pidx.droplevel([0, 2.0]), psidx.droplevel([0, 2.0])
      )
  
file_path: spark/python/pyspark/pandas/tests/indexes/test_drop.py
imports: import unittest
  import numpy
  import pandas
  import pyspark.pandas
  from pyspark.testing.pandasutils import ComparisonTestBase, TestUtils
label_desc: Use image node_id 4 for calling the IndexesDropMixin obj's underlying member method code with example usage: obj.test_multiindex_droplevel() without return types