class_docstr: pandas-on-Spark MultiIndex that corresponds to pandas MultiIndex logically. This might hold
  Spark Column internally.
  
  Parameters
  ----------
  levels : sequence of arrays
      The unique labels for each level.
  codes : sequence of arrays
      Integers for each level designating which label at each location.
  sortorder : optional int
      Level of sortedness (must be lexicographically sorted by that
      level).
  names : optional sequence of objects
      Names for each of the index levels. (name is accepted for compat).
  copy : bool, default False
      Copy the meta-data.
  verify_integrity : bool, default True
      Check that the levels/codes are consistent and valid.
  
  See Also
  --------
  MultiIndex.from_arrays  : Convert list of arrays to MultiIndex.
  MultiIndex.from_product : Create a MultiIndex from the cartesian product
                            of iterables.
  MultiIndex.from_tuples  : Convert list of tuples to a MultiIndex.
  MultiIndex.from_frame   : Make a MultiIndex from a DataFrame.
  Index : A single-level Index.
  
  Examples
  --------
  >>> ps.DataFrame({'a': ['a', 'b', 'c']}, index=[[1, 2, 3], [4, 5, 6]]).index  # doctest: +SKIP
  MultiIndex([(1, 4),
              (2, 5),
              (3, 6)],
             )
  
  >>> ps.DataFrame({'a': [1, 2, 3]}, index=[list('abc'), list('def')]).index  # doctest: +SKIP
  MultiIndex([('a', 'd'),
              ('b', 'e'),
              ('c', 'f')],
             )
class_docstr_tok: ["pandas-on-Spark","MultiIndex","that","corresponds","to","pandas","MultiIndex","logically",".","This","might","hold","Spark","Column","internally",".","Parameters","--","--","--","--","--","levels",":","sequence","of","arrays","The","unique","labels","for","each","level",".","codes",":","sequence","of","arrays","Integers","for","each","level","designating","which","label","at","each","location",".","sortorder",":","optional","int","Level","of","sortedness","(","must","be","lexicographically","sorted","by","that","level",")",".","names",":","optional","sequence","of","objects","Names","for","each","of","the","index","levels",".","(","name","is","accepted","for","compat",")",".","copy",":","bool",",","default","False","Copy","the","meta-data",".","verify_integrity",":","bool",",","default","True","Check","that","the","levels\/codes","are","consistent","and","valid",".","See","Also","--","--","--","--","MultiIndex.from_arrays",":","Convert","list","of","arrays","to","MultiIndex",".","MultiIndex.from_product",":","Create","a","MultiIndex","from","the","cartesian","product","of","iterables",".","MultiIndex.from_tuples",":","Convert","list","of","tuples","to","a","MultiIndex",".","MultiIndex.from_frame",":","Make","a","MultiIndex","from","a","DataFrame",".","Index",":","A","single-level","Index",".","Examples","--","--","--","--",">",">",">","ps.DataFrame","(","{","'","a","'",":","[","'","a","'",",","'","b","'",",","'","c","'","]","}",",","index=","[","[","1",",","2",",","3","]",",","[","4",",","5",",","6","]","]",")",".index","#","doctest",":","+SKIP","MultiIndex","(","[","(","1",",","4",")",",","(","2",",","5",")",",","(","3",",","6",")","]",",",")",">",">",">","ps.DataFrame","(","{","'","a","'",":","[","1",",","2",",","3","]","}",",","index=","[","list","(","'abc","'",")",",","list","(","'def","'",")","]",")",".index","#","doctest",":","+SKIP","MultiIndex","(","[","(","'","a","'",",","'d","'",")",",","(","'","b","'",",","'","e","'",")",",","(","'","c","'",",","'","f","'",")","]",",",")"]
docstr: Make a MultiIndex from a DataFrame.
  
  Parameters
  ----------
  df : DataFrame
      DataFrame to be converted to MultiIndex.
  names : list-like, optional
      If no names are provided, use the column names, or tuple of column
      names if the column 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 = ps.DataFrame([['HI', 'Temp'], ['HI', 'Precip'],
  ...                    ['NJ', 'Temp'], ['NJ', 'Precip']],
  ...                   columns=['a', 'b'])
  >>> df  # doctest: +SKIP
        a       b
  0    HI    Temp
  1    HI  Precip
  2    NJ    Temp
  3    NJ  Precip
  
  >>> ps.MultiIndex.from_frame(df)  # doctest: +SKIP
  MultiIndex([('HI',   'Temp'),
              ('HI', 'Precip'),
              ('NJ',   'Temp'),
              ('NJ', 'Precip')],
             names=['a', 'b'])
  
  Using explicit names, instead of the column names
  
  >>> ps.MultiIndex.from_frame(df, names=['state', 'observation'])  # doctest: +SKIP
  MultiIndex([('HI',   'Temp'),
              ('HI', 'Precip'),
              ('NJ',   'Temp'),
              ('NJ', 'Precip')],
             names=['state', 'observation'])
docstr_tok: ["Make","a","MultiIndex","from","a","DataFrame",".","Parameters","--","--","--","--","--","df",":","DataFrame","DataFrame","to","be","converted","to","MultiIndex",".","names",":","list-like",",","optional","If","no","names","are","provided",",","use","the","column","names",",","or","tuple","of","column","names","if","the","column","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","=","ps.DataFrame","(","[","[","'HI","'",",","'Temp","'","]",",","[","'HI","'",",","'Precip","'","]",",","...","[","'NJ","'",",","'Temp","'","]",",","[","'NJ","'",",","'Precip","'","]","]",",","...","columns=","[","'","a","'",",","'","b","'","]",")",">",">",">","df","#","doctest",":","+SKIP","a","b","0","HI","Temp","1","HI","Precip","2","NJ","Temp","3","NJ","Precip",">",">",">","ps.MultiIndex.from_frame","(","df",")","#","doctest",":","+SKIP","MultiIndex","(","[","(","'HI","'",",","'Temp","'",")",",","(","'HI","'",",","'Precip","'",")",",","(","'NJ","'",",","'Temp","'",")",",","(","'NJ","'",",","'Precip","'",")","]",",","names=","[","'","a","'",",","'","b","'","]",")","Using","explicit","names",",","instead","of","the","column","names",">",">",">","ps.MultiIndex.from_frame","(","df",",","names=","[","'state","'",",","'observation","'","]",")","#","doctest",":","+SKIP","MultiIndex","(","[","(","'HI","'",",","'Temp","'",")",",","(","'HI","'",",","'Precip","'",")",",","(","'NJ","'",",","'Temp","'",")",",","(","'NJ","'",",","'Precip","'",")","]",",","names=","[","'state","'",",","'observation","'","]",")"]
code: def from_frame(
      df: DataFrame, names: Optional[List[Name]] = None
  ) -> "MultiIndex":
      """
      Make a MultiIndex from a DataFrame.
  
      Parameters
      ----------
      df : DataFrame
          DataFrame to be converted to MultiIndex.
      names : list-like, optional
          If no names are provided, use the column names, or tuple of column
          names if the column 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 = ps.DataFrame([['HI', 'Temp'], ['HI', 'Precip'],
      ...                    ['NJ', 'Temp'], ['NJ', 'Precip']],
      ...                   columns=['a', 'b'])
      >>> df  # doctest: +SKIP
            a       b
      0    HI    Temp
      1    HI  Precip
      2    NJ    Temp
      3    NJ  Precip
  
      >>> ps.MultiIndex.from_frame(df)  # doctest: +SKIP
      MultiIndex([('HI',   'Temp'),
                  ('HI', 'Precip'),
                  ('NJ',   'Temp'),
                  ('NJ', 'Precip')],
                 names=['a', 'b'])
  
      Using explicit names, instead of the column names
  
      >>> ps.MultiIndex.from_frame(df, names=['state', 'observation'])  # doctest: +SKIP
      MultiIndex([('HI',   'Temp'),
                  ('HI', 'Precip'),
                  ('NJ',   'Temp'),
                  ('NJ', 'Precip')],
                 names=['state', 'observation'])
      """
      if not isinstance(df, DataFrame):
          raise TypeError("Input must be a DataFrame")
      sdf = df._to_spark()
  
      if names is None:
          names = df._internal.column_labels
      elif not is_list_like(names):
          raise TypeError("Names should be list-like for a MultiIndex")
      else:
          names = [
              name if is_name_like_tuple(name) else (name,)
              for name in names
          ]
  
      internal = InternalFrame(
          spark_frame=sdf,
          index_spark_columns=[
              scol_for(sdf, col) for col in sdf.columns
          ],
          index_names=names,
      )
      return cast(MultiIndex, DataFrame(internal).index)
  
imports: from functools import partial, reduce
  from typing import Any, Callable, Iterator, List, Optional, Tuple, Union, cast, no_type_check
  import pandas
  from pandas.api.types import is_hashable, is_list_like
  from pyspark.sql import functions, Column, Window
  from pyspark.sql.types import DataType
  from pyspark.sql.utils import get_column_class
  from pyspark import pandas
  from pyspark.pandas._typing import Label, Name, Scalar
  from pyspark.pandas.exceptions import PandasNotImplementedError
  from pyspark.pandas.frame import DataFrame
  from pyspark.pandas.indexes.base import Index
  from pyspark.pandas.missing.indexes import MissingPandasLikeMultiIndex
  from pyspark.pandas.series import Series, first_series
  from pyspark.pandas.utils import compare_disallow_null, is_name_like_tuple, name_like_string, scol_for, verify_temp_column_name, validate_index_loc, xor
  from pyspark.pandas.internal import InternalField, InternalFrame, NATURAL_ORDER_COLUMN_NAME, SPARK_INDEX_NAME_FORMAT
label_desc: Use image node_id 11 for calling the MultiIndex obj's underlying member method code with example usage: obj.from_frame(df, names) and returns: cast