MultiIndex.from_tuples()
pandas.MultiIndex.from_tuples
-
classmethod MultiIndex.from_tuples(tuples, sortorder=None, names=None)
-
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)
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
Examples
>>> tuples = [(1, u'red'), (1, u'blue'), (2, u'red'), (2, u'blue')] >>> MultiIndex.from_tuples(tuples, names=('number', 'color'))
-
© 2011–2012 Lambda Foundry, Inc. and PyData Development Team
© 2008–2011 AQR Capital Management, LLC
© 2008–2014 the pandas development team
Licensed under the 3-clause BSD License.
http://pandas.pydata.org/pandas-docs/version/0.18.1/generated/pandas.MultiIndex.from_tuples.html