code: def test_index_symmetric_difference(self):
      pidx1 = pd.Index([1, 2, 3, 4])
      pidx2 = pd.Index([2, 3, 4, 5])
      psidx1 = ps.from_pandas(pidx1)
      psidx2 = ps.from_pandas(pidx2)
  
      self.assert_eq(
          psidx1.symmetric_difference(psidx2).sort_values(),
          pidx1.symmetric_difference(pidx2).sort_values(),
      )
      self.assert_eq(
          (psidx1 + 1).symmetric_difference(psidx2).sort_values(),
          (pidx1 + 1).symmetric_difference(pidx2).sort_values(),
      )
      # No longer supported from pandas 2.0.0.
      if LooseVersion(pd.__version__) >= LooseVersion("2.0.0"):
          self.assert_eq(
              (psidx1 ^ psidx2).sort_values(),
              ps.Index([1, 5], dtype="int64"),
          )
      else:
          self.assert_eq(
              (psidx1 ^ psidx2).sort_values(),
              (pidx1 ^ pidx2).sort_values(),
          )
      self.assert_eq(
          psidx1.symmetric_difference(
              psidx2, result_name="result"
          ).sort_values(),
          pidx1.symmetric_difference(
              pidx2, result_name="result"
          ).sort_values(),
      )
  
      pmidx1 = pd.MultiIndex(
          [["lama", "cow", "falcon"], ["speed", "weight", "length"]],
          [[0, 0, 0, 1, 1, 1, 2, 2, 2], [0, 0, 0, 0, 1, 2, 0, 1, 2]],
      )
      pmidx2 = pd.MultiIndex(
          [["koalas", "cow", "falcon"], ["speed", "weight", "length"]],
          [[0, 0, 0, 1, 1, 1, 2, 2, 2], [0, 0, 0, 0, 1, 2, 0, 1, 2]],
      )
      psmidx1 = ps.from_pandas(pmidx1)
      psmidx2 = ps.from_pandas(pmidx2)
  
      self.assert_eq(
          psmidx1.symmetric_difference(psmidx2).sort_values(),
          pmidx1.symmetric_difference(pmidx2).sort_values(),
      )
  
      # Pandas has a bug that raise TypeError when setting `result_name` for MultiIndex.
      pandas_result = pmidx1.symmetric_difference(pmidx2)
      pandas_result.names = ["a", "b"]
      self.assert_eq(
          psmidx1.symmetric_difference(
              psmidx2, result_name=["a", "b"]
          ).sort_values(),
          pandas_result,
      )
  
      # Pandas sort the result by default, so doesn't provide the `True` for sort.
      self.assert_eq(
          psmidx1.symmetric_difference(psmidx2, sort=True),
          pmidx1.symmetric_difference(pmidx2),
      )
  
      idx = ps.Index(["a", "b", "c"])
      midx = ps.MultiIndex.from_tuples(
          [("a", "x"), ("b", "y"), ("c", "z")]
      )
  
      with self.assertRaisesRegex(
          NotImplementedError, "Doesn't support*"
      ):
          idx.symmetric_difference(midx)
  
file_path: spark/python/pyspark/pandas/tests/indexes/test_symmetric_diff.py
imports: import unittest
  import pandas
  import pyspark.pandas
  from pyspark.loose_version import LooseVersion
  from pyspark.testing.pandasutils import ComparisonTestBase, TestUtils
label_desc: Use image node_id 1 for calling the IndexesSymmetricDiffMixin obj's underlying member method code with example usage: obj.test_index_symmetric_difference() without return types