nodes: 0, module; 1, function_definition; 2, function_name:symmetric_difference; 3, parameters; 4, block; 5, identifier:self; 6, identifier:other; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, if_statement; 14, expression_statement; 15, expression_statement; 16, expression_statement; 17, comment:# {this} minus {other}; 18, expression_statement; 19, expression_statement; 20, expression_statement; 21, comment:# {other} minus {this}; 22, expression_statement; 23, expression_statement; 24, expression_statement; 25, if_statement; 26, expression_statement; 27, expression_statement; 28, if_statement; 29, return_statement; 30, identifier:result_name; 31, None; 32, identifier:sort; 33, None; 34, comment:"""
          Compute the symmetric difference of two Index objects.
  
          Parameters
          ----------
          other : Index or array-like
          result_name : str
          sort : False or None, default None
              Whether to sort the resulting index. By default, the
              values are attempted to be sorted, but any TypeError from
              incomparable elements is caught by pandas.
  
              * None : Attempt to sort the result, but catch any TypeErrors
                from comparing incomparable elements.
              * False : Do not sort the result.
  
              .. versionadded:: 0.24.0
  
              .. versionchanged:: 0.24.1
  
                 Changed the default value from ``True`` to ``None``
                 (without change in behaviour).
  
          Returns
          -------
          symmetric_difference : Index
  
          Notes
          -----
          ``symmetric_difference`` contains elements that appear in either
          ``idx1`` or ``idx2`` but not both. Equivalent to the Index created by
          ``idx1.difference(idx2) | idx2.difference(idx1)`` with duplicates
          dropped.
  
          Examples
          --------
          >>> idx1 = pd.Index([1, 2, 3, 4])
          >>> idx2 = pd.Index([2, 3, 4, 5])
          >>> idx1.symmetric_difference(idx2)
          Int64Index([1, 5], dtype='int64')
  
          You can also use the ``^`` operator:
  
          >>> idx1 ^ idx2
          Int64Index([1, 5], dtype='int64')
          """; 35, call; 36, call; 37, assignment; 38, comparison_operator:result_name is None; 39, block; 40, assignment; 41, assignment; 42, assignment; 43, assignment; 44, assignment; 45, assignment; 46, assignment; 47, assignment; 48, assignment; 49, comparison_operator:sort is None; 50, block; 51, assignment; 52, assignment; 53, comparison_operator:'freq' in attribs; 54, block; 55, call; 56, attribute; 57, argument_list; 58, attribute; 59, argument_list; 60, pattern_list; 61, call; 62, identifier:result_name; 63, None; 64, expression_statement; 65, identifier:this; 66, call; 67, identifier:other; 68, call; 69, identifier:indexer; 70, call; 71, identifier:common_indexer; 72, call; 73, identifier:left_indexer; 74, call; 75, identifier:left_diff; 76, call; 77, identifier:right_indexer; 78, subscript; 79, identifier:right_diff; 80, call; 81, identifier:the_diff; 82, call; 83, identifier:sort; 84, None; 85, try_statement; 86, identifier:attribs; 87, call; 88, subscript; 89, identifier:result_name; 90, string; 91, identifier:attribs; 92, expression_statement; 93, attribute; 94, argument_list; 95, identifier:self; 96, identifier:_validate_sort_keyword; 97, identifier:sort; 98, identifier:self; 99, identifier:_assert_can_do_setop; 100, identifier:other; 101, identifier:other; 102, identifier:result_name_update; 103, attribute; 104, argument_list; 105, assignment; 106, attribute; 107, argument_list; 108, attribute; 109, argument_list; 110, attribute; 111, argument_list; 112, attribute; 113, argument_list; 114, attribute; 115, argument_list; 116, attribute; 117, argument_list; 118, call; 119, integer:0; 120, attribute; 121, argument_list; 122, attribute; 123, argument_list; 124, block; 125, except_clause; 126, attribute; 127, argument_list; 128, identifier:attribs; 129, string; 130, string_content:freq; 131, assignment; 132, identifier:self; 133, identifier:_shallow_copy_with_infer; 134, identifier:the_diff; 135, dictionary_splat; 136, identifier:self; 137, identifier:_convert_can_do_setop; 138, identifier:other; 139, identifier:result_name; 140, identifier:result_name_update; 141, identifier:self; 142, identifier:_get_unique_index; 143, identifier:other; 144, identifier:_get_unique_index; 145, identifier:this; 146, identifier:get_indexer; 147, identifier:other; 148, identifier:indexer; 149, identifier:take; 150, subscript; 151, identifier:np; 152, identifier:setdiff1d; 153, call; 154, identifier:common_indexer; 155, keyword_argument; 156, attribute; 157, identifier:take; 158, identifier:left_indexer; 159, attribute; 160, argument_list; 161, attribute; 162, identifier:take; 163, identifier:right_indexer; 164, identifier:_concat; 165, identifier:_concat_compat; 166, list; 167, expression_statement; 168, identifier:TypeError; 169, block; 170, identifier:self; 171, identifier:_get_attributes_dict; 172, string_content:name; 173, subscript; 174, None; 175, identifier:attribs; 176, call; 177, integer:0; 178, attribute; 179, argument_list; 180, identifier:assume_unique; 181, True; 182, identifier:this; 183, identifier:values; 184, parenthesized_expression; 185, identifier:nonzero; 186, identifier:other; 187, identifier:values; 188, identifier:left_diff; 189, identifier:right_diff; 190, assignment; 191, pass_statement; 192, identifier:attribs; 193, string; 194, attribute; 195, argument_list; 196, identifier:np; 197, identifier:arange; 198, attribute; 199, comparison_operator:indexer == -1; 200, identifier:the_diff; 201, call; 202, string_content:freq; 203, parenthesized_expression; 204, identifier:nonzero; 205, identifier:this; 206, identifier:size; 207, identifier:indexer; 208, unary_operator; 209, attribute; 210, argument_list; 211, comparison_operator:indexer != -1; 212, integer:1; 213, identifier:sorting; 214, identifier:safe_sort; 215, identifier:the_diff; 216, identifier:indexer; 217, unary_operator; 218, integer:1
code: def symmetric_difference(self, other, result_name=None, sort=None):
          """
          Compute the symmetric difference of two Index objects.
  
          Parameters
          ----------
          other : Index or array-like
          result_name : str
          sort : False or None, default None
              Whether to sort the resulting index. By default, the
              values are attempted to be sorted, but any TypeError from
              incomparable elements is caught by pandas.
  
              * None : Attempt to sort the result, but catch any TypeErrors
                from comparing incomparable elements.
              * False : Do not sort the result.
  
              .. versionadded:: 0.24.0
  
              .. versionchanged:: 0.24.1
  
                 Changed the default value from ``True`` to ``None``
                 (without change in behaviour).
  
          Returns
          -------
          symmetric_difference : Index
  
          Notes
          -----
          ``symmetric_difference`` contains elements that appear in either
          ``idx1`` or ``idx2`` but not both. Equivalent to the Index created by
          ``idx1.difference(idx2) | idx2.difference(idx1)`` with duplicates
          dropped.
  
          Examples
          --------
          >>> idx1 = pd.Index([1, 2, 3, 4])
          >>> idx2 = pd.Index([2, 3, 4, 5])
          >>> idx1.symmetric_difference(idx2)
          Int64Index([1, 5], dtype='int64')
  
          You can also use the ``^`` operator:
  
          >>> idx1 ^ idx2
          Int64Index([1, 5], dtype='int64')
          """
          self._validate_sort_keyword(sort)
          self._assert_can_do_setop(other)
          other, result_name_update = self._convert_can_do_setop(other)
          if result_name is None:
              result_name = result_name_update
  
          this = self._get_unique_index()
          other = other._get_unique_index()
          indexer = this.get_indexer(other)
  
          # {this} minus {other}
          common_indexer = indexer.take((indexer != -1).nonzero()[0])
          left_indexer = np.setdiff1d(np.arange(this.size), common_indexer,
                                      assume_unique=True)
          left_diff = this.values.take(left_indexer)
  
          # {other} minus {this}
          right_indexer = (indexer == -1).nonzero()[0]
          right_diff = other.values.take(right_indexer)
  
          the_diff = _concat._concat_compat([left_diff, right_diff])
          if sort is None:
              try:
                  the_diff = sorting.safe_sort(the_diff)
              except TypeError:
                  pass
  
          attribs = self._get_attributes_dict()
          attribs['name'] = result_name
          if 'freq' in attribs:
              attribs['freq'] = None
          return self._shallow_copy_with_infer(the_diff, **attribs)