code: def test_insert(self):
      #
      # Basic DataFrame
      #
      pdf = pd.DataFrame([1, 2, 3])
      psdf = ps.from_pandas(pdf)
  
      psdf.insert(1, "b", 10)
      pdf.insert(1, "b", 10)
      self.assert_eq(psdf.sort_index(), pdf.sort_index(), almost=True)
      psdf.insert(2, "c", 0.1)
      pdf.insert(2, "c", 0.1)
      self.assert_eq(psdf.sort_index(), pdf.sort_index(), almost=True)
      psdf.insert(3, "d", psdf.b + 1)
      pdf.insert(3, "d", pdf.b + 1)
      self.assert_eq(psdf.sort_index(), pdf.sort_index(), almost=True)
  
      psser = ps.Series([4, 5, 6])
      self.assertRaises(ValueError, lambda: psdf.insert(0, "y", psser))
      self.assertRaisesRegex(
          ValueError,
          "cannot insert b, already exists",
          lambda: psdf.insert(1, "b", 10),
      )
      self.assertRaisesRegex(
          TypeError,
          '"column" should be a scalar value or tuple that contains scalar values',
          lambda: psdf.insert(0, list("abc"), psser),
      )
      self.assertRaisesRegex(
          TypeError,
          "loc must be int",
          lambda: psdf.insert((1,), "b", 10),
      )
      self.assertRaisesRegex(
          NotImplementedError,
          "Assigning column name as tuple is only supported for MultiIndex columns for now.",
          lambda: psdf.insert(0, ("e",), 10),
      )
  
      self.assertRaises(
          ValueError, lambda: psdf.insert(0, "e", [7, 8, 9, 10])
      )
      self.assertRaises(
          ValueError, lambda: psdf.insert(0, "f", ps.Series([7, 8]))
      )
      self.assertRaises(
          AssertionError, lambda: psdf.insert(100, "y", psser)
      )
      self.assertRaises(
          AssertionError,
          lambda: psdf.insert(1, "y", psser, allow_duplicates=True),
      )
  
      #
      # DataFrame with MultiIndex as columns
      #
      pdf = pd.DataFrame({("x", "a", "b"): [1, 2, 3]})
      psdf = ps.from_pandas(pdf)
  
      psdf.insert(1, "b", 10)
      pdf.insert(1, "b", 10)
      self.assert_eq(psdf.sort_index(), pdf.sort_index(), almost=True)
      psdf.insert(2, "c", 0.1)
      pdf.insert(2, "c", 0.1)
      self.assert_eq(psdf.sort_index(), pdf.sort_index(), almost=True)
      psdf.insert(3, "d", psdf.b + 1)
      pdf.insert(3, "d", pdf.b + 1)
      self.assert_eq(psdf.sort_index(), pdf.sort_index(), almost=True)
  
      self.assertRaisesRegex(
          ValueError,
          "cannot insert d, already exists",
          lambda: psdf.insert(4, "d", 11),
      )
      self.assertRaisesRegex(
          ValueError,
          r"cannot insert \('x', 'a', 'b'\), already exists",
          lambda: psdf.insert(4, ("x", "a", "b"), 11),
      )
      self.assertRaisesRegex(
          ValueError,
          '"column" must have length equal to number of column levels.',
          lambda: psdf.insert(4, ("e",), 11),
      )
  
imports: import unittest
  import numpy
  import pandas
  from pyspark import pandas
  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 11 for calling the FrameIndexingMixin obj's underlying member method code with example usage: obj.test_insert() without return types