pyspark.pandas.Index.item

Index.item() → Union[int, float, bool, str, bytes, decimal.Decimal, datetime.date, datetime.datetime, None, 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 scalar.

Returns
scalar

The first element of Index.

Raises
ValueError

If the data is not length-1.

Examples

>>> psidx = ps.Index([10])
>>> psidx.item()
10