nodes: 0, module; 1, function_definition; 2, function_name:from_frame; 3, parameters; 4, block; 5, identifier:cls; 6, identifier:df; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, if_statement; 11, expression_statement; 12, expression_statement; 13, return_statement; 14, identifier:sortorder; 15, None; 16, identifier:names; 17, None; 18, comment:"""
          Make a MultiIndex from a DataFrame.
  
          .. versionadded:: 0.24.0
  
          Parameters
          ----------
          df : DataFrame
              DataFrame to be converted to MultiIndex.
          sortorder : int, optional
              Level of sortedness (must be lexicographically sorted by that
              level).
          names : list-like, optional
              If no names are provided, use the column names, or tuple of column
              names if the columns is a MultiIndex. If a sequence, overwrite
              names with the given sequence.
  
          Returns
          -------
          MultiIndex
              The MultiIndex representation of the given DataFrame.
  
          See Also
          --------
          MultiIndex.from_arrays : Convert list of arrays to MultiIndex.
          MultiIndex.from_tuples : Convert list of tuples to MultiIndex.
          MultiIndex.from_product : Make a MultiIndex from cartesian product
                                    of iterables.
  
          Examples
          --------
          >>> df = pd.DataFrame([['HI', 'Temp'], ['HI', 'Precip'],
          ...                    ['NJ', 'Temp'], ['NJ', 'Precip']],
          ...                   columns=['a', 'b'])
          >>> df
                a       b
          0    HI    Temp
          1    HI  Precip
          2    NJ    Temp
          3    NJ  Precip
  
          >>> pd.MultiIndex.from_frame(df)
          MultiIndex(levels=[['HI', 'NJ'], ['Precip', 'Temp']],
                     codes=[[0, 0, 1, 1], [1, 0, 1, 0]],
                     names=['a', 'b'])
  
          Using explicit names, instead of the column names
  
          >>> pd.MultiIndex.from_frame(df, names=['state', 'observation'])
          MultiIndex(levels=[['HI', 'NJ'], ['Precip', 'Temp']],
                     codes=[[0, 0, 1, 1], [1, 0, 1, 0]],
                     names=['state', 'observation'])
          """; 19, not_operator; 20, block; 21, assignment; 22, assignment; 23, call; 24, call; 25, raise_statement; 26, pattern_list; 27, call; 28, identifier:names; 29, conditional_expression:column_names if names is None else names; 30, attribute; 31, argument_list; 32, identifier:isinstance; 33, argument_list; 34, call; 35, identifier:column_names; 36, identifier:columns; 37, identifier:lzip; 38, argument_list; 39, identifier:column_names; 40, comparison_operator:names is None; 41, identifier:names; 42, identifier:cls; 43, identifier:from_arrays; 44, identifier:columns; 45, keyword_argument; 46, keyword_argument; 47, identifier:df; 48, identifier:ABCDataFrame; 49, identifier:TypeError; 50, argument_list; 51, list_splat; 52, identifier:names; 53, None; 54, identifier:sortorder; 55, identifier:sortorder; 56, identifier:names; 57, identifier:names; 58, string:"Input must be a DataFrame"; 59, call; 60, attribute; 61, argument_list; 62, identifier:df; 63, identifier:iteritems
code: def from_frame(cls, df, sortorder=None, names=None):
          """
          Make a MultiIndex from a DataFrame.
  
          .. versionadded:: 0.24.0
  
          Parameters
          ----------
          df : DataFrame
              DataFrame to be converted to MultiIndex.
          sortorder : int, optional
              Level of sortedness (must be lexicographically sorted by that
              level).
          names : list-like, optional
              If no names are provided, use the column names, or tuple of column
              names if the columns is a MultiIndex. If a sequence, overwrite
              names with the given sequence.
  
          Returns
          -------
          MultiIndex
              The MultiIndex representation of the given DataFrame.
  
          See Also
          --------
          MultiIndex.from_arrays : Convert list of arrays to MultiIndex.
          MultiIndex.from_tuples : Convert list of tuples to MultiIndex.
          MultiIndex.from_product : Make a MultiIndex from cartesian product
                                    of iterables.
  
          Examples
          --------
          >>> df = pd.DataFrame([['HI', 'Temp'], ['HI', 'Precip'],
          ...                    ['NJ', 'Temp'], ['NJ', 'Precip']],
          ...                   columns=['a', 'b'])
          >>> df
                a       b
          0    HI    Temp
          1    HI  Precip
          2    NJ    Temp
          3    NJ  Precip
  
          >>> pd.MultiIndex.from_frame(df)
          MultiIndex(levels=[['HI', 'NJ'], ['Precip', 'Temp']],
                     codes=[[0, 0, 1, 1], [1, 0, 1, 0]],
                     names=['a', 'b'])
  
          Using explicit names, instead of the column names
  
          >>> pd.MultiIndex.from_frame(df, names=['state', 'observation'])
          MultiIndex(levels=[['HI', 'NJ'], ['Precip', 'Temp']],
                     codes=[[0, 0, 1, 1], [1, 0, 1, 0]],
                     names=['state', 'observation'])
          """
          if not isinstance(df, ABCDataFrame):
              raise TypeError("Input must be a DataFrame")
  
          column_names, columns = lzip(*df.iteritems())
          names = column_names if names is None else names
          return cls.from_arrays(columns, sortorder=sortorder, names=names)