code: def test_multiindex_from_frame(self):
      pdf = pd.DataFrame(
          [
              ["HI", "Temp"],
              ["HI", "Precip"],
              ["NJ", "Temp"],
              ["NJ", "Precip"],
          ],
          columns=["a", "b"],
      )
      psdf = ps.from_pandas(pdf)
      pidx = pd.MultiIndex.from_frame(pdf)
      psidx = ps.MultiIndex.from_frame(psdf)
  
      self.assert_eq(pidx, psidx)
  
      # Specify `names`
      pidx = pd.MultiIndex.from_frame(
          pdf, names=["state", "observation"]
      )
      psidx = ps.MultiIndex.from_frame(
          psdf, names=["state", "observation"]
      )
      self.assert_eq(pidx, psidx)
  
      pidx = pd.MultiIndex.from_frame(
          pdf, names=("state", "observation")
      )
      psidx = ps.MultiIndex.from_frame(
          psdf, names=("state", "observation")
      )
      self.assert_eq(pidx, psidx)
  
      # MultiIndex columns
      pidx = pd.MultiIndex.from_tuples([("a", "w"), ("b", "x")])
      pdf.columns = pidx
      psdf = ps.from_pandas(pdf)
  
      pidx = pd.MultiIndex.from_frame(pdf)
      psidx = ps.MultiIndex.from_frame(psdf)
  
      self.assert_eq(pidx, psidx)
  
      # tuples for names
      pidx = pd.MultiIndex.from_frame(
          pdf, names=[("a", "w"), ("b", "x")]
      )
      psidx = ps.MultiIndex.from_frame(
          psdf, names=[("a", "w"), ("b", "x")]
      )
  
      self.assert_eq(pidx, psidx)
  
      err_msg = "Input must be a DataFrame"
      with self.assertRaisesRegex(TypeError, err_msg):
          ps.MultiIndex.from_frame({"a": [1, 2, 3], "b": [4, 5, 6]})
  
      self.assertRaises(
          TypeError, lambda: ps.MultiIndex.from_frame(psdf, names="ab")
      )
  
      # non-string names
      self.assert_eq(
          ps.MultiIndex.from_frame(psdf, names=[0, 1]),
          pd.MultiIndex.from_frame(pdf, names=[0, 1]),
      )
      self.assert_eq(
          ps.MultiIndex.from_frame(psdf, names=[("x", 0), ("y", 1)]),
          pd.MultiIndex.from_frame(pdf, names=[("x", 0), ("y", 1)]),
      )
  
      pdf = pd.DataFrame(
          [
              ["HI", "Temp"],
              ["HI", "Precip"],
              ["NJ", "Temp"],
              ["NJ", "Precip"],
          ]
      )
      psdf = ps.from_pandas(pdf)
      self.assert_eq(
          ps.MultiIndex.from_frame(psdf), pd.MultiIndex.from_frame(pdf)
      )
  
imports: import unittest
  from datetime import datetime
  import pandas
  from pyspark import pandas
  from pyspark.loose_version import LooseVersion
  from pyspark.testing.pandasutils import PandasOnSparkTestCase, SPARK_CONF_ARROW_ENABLED
  from pyspark.testing.sqlutils import SQLTestUtils
label_desc: Use image node_id 9 for calling the ConversionMixin obj's underlying member method code with example usage: obj.test_multiindex_from_frame() without return types