pyspark.pandas.MultiIndex.item

MultiIndex.item() → Tuple[Union[int, float, bool, str, bytes, decimal.Decimal, datetime.date, datetime.datetime, None], …]

Return the first element of the underlying data as a python tuple.

Returns
tuple

The first element of MultiIndex.

Raises
ValueError

If the data is not length-1.

Examples

>>> psmidx = ps.MultiIndex.from_tuples([('a', 'x')])
>>> psmidx.item()
('a', 'x')