bigframes.pandas.MultiIndex.from_tuples#

classmethodMultiIndex.from_tuples(tuples:Iterable[tuple[Hashable,...]],sortorder:int|None=None,names:Sequence[Hashable]|Hashable|None=None,*,session:bigframes.session.Session|None=None)MultiIndex[source]#

Convert list of tuples to MultiIndex.

Examples:

>>>tuples=[(1,'red'),(1,'blue'),...(2,'red'),(2,'blue')]>>>bpd.MultiIndex.from_tuples(tuples,names=('number','color'))MultiIndex([(1,  'red'),            (1, 'blue'),            (2,  'red'),            (2, 'blue')],        names=['number', 'color'])
Parameters:
  • tuples (list / sequence oftuple-likes) – Each tuple is the index of one row/column.

  • sortorder (int orNone) – Level of sortedness (must be lexicographically sorted by thatlevel).

  • names (list / sequence ofstr,optional) – Names for the levels in the index.

Returns:

MultiIndex