pyspark.pandas.Series.items#

Series.items()[source]#

Lazily iterate over (index, value) tuples.

This method returns an iterable tuple (index, value). This is convenient if you want to create a lazy iterator.

Note

Unlike pandas’, the itmes in pandas-on-Spark returns generator rather zip object

Returns
iterable

Iterable of tuples containing the (index, value) pairs from a Series.

See also

DataFrame.items

Iterate over (column name, Series) pairs.

DataFrame.iterrows

Iterate over DataFrame rows as (index, Series) pairs.

Examples

>>> s = ps.Series(['A', 'B', 'C'])
>>> for index, value in s.items():
...     print("Index : {}, Value : {}".format(index, value))
Index : 0, Value : A
Index : 1, Value : B
Index : 2, Value : C