@classmethod<EOL><INDENT>def from_tuples(cls, tuples, sortorder=None, names=None):<DEDENT>
if not is_list_like(tuples):<EOL><INDENT>raise TypeError('<STR_LIT>')<EOL><DEDENT>elif is_iterator(tuples):<EOL><INDENT>tuples = list(tuples)<EOL><DEDENT>if len(tuples) == <NUM_LIT:0>:<EOL><INDENT>if names is None:<EOL><INDENT>msg = '<STR_LIT>'<EOL>raise TypeError(msg)<EOL><DEDENT>arrays = [[]] * len(names)<EOL><DEDENT>elif isinstance(tuples, (np.ndarray, Index)):<EOL><INDENT>if isinstance(tuples, Index):<EOL><INDENT>tuples = tuples._values<EOL><DEDENT>arrays = list(lib.tuples_to_object_array(tuples).T)<EOL><DEDENT>elif isinstance(tuples, list):<EOL><INDENT>arrays = list(lib.to_object_array_tuples(tuples).T)<EOL><DEDENT>else:<EOL><INDENT>arrays = lzip(*tuples)<EOL><DEDENT>return MultiIndex.from_arrays(arrays, sortorder=sortorder, names=names)<EOL>
Convert list of tuples to MultiIndex.

Parameters
----------
tuples : list / sequence of tuple-likes
    Each tuple is the index of one row/column.
sortorder : int or None
    Level of sortedness (must be lexicographically sorted by that
    level).
names : list / sequence of str, optional
    Names for the levels in the index.

Returns
-------
index : MultiIndex

See Also
--------
MultiIndex.from_arrays : Convert list of arrays to MultiIndex.
MultiIndex.from_product : Make a MultiIndex from cartesian product
                          of iterables.
MultiIndex.from_frame : Make a MultiIndex from a DataFrame.

Examples
--------
>>> tuples = [(1, 'red'), (1, 'blue'),
...           (2, 'red'), (2, 'blue')]
>>> pd.MultiIndex.from_tuples(tuples, names=('number', 'color'))
MultiIndex(levels=[[1, 2], ['blue', 'red']],
           codes=[[0, 0, 1, 1], [1, 0, 1, 0]],
           names=['number', 'color'])