Skip to content

Commit 406e7ea

Browse files
HubertKlWillAyd
authored andcommitted
DOC: Improve the docsting of Series.iteritems (#24879)
1 parent 19ad3f0 commit 406e7ea

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

pandas/core/series.py

+23
Original file line numberDiff line numberDiff line change
@@ -1453,6 +1453,29 @@ def to_string(self, buf=None, na_rep='NaN', float_format=None, header=True,
14531453
def iteritems(self):
14541454
"""
14551455
Lazily iterate over (index, value) tuples.
1456+
1457+
This method returns an iterable tuple (index, value). This is
1458+
convienient if you want to create a lazy iterator. Note that the
1459+
methods Series.items and Series.iteritems are the same methods.
1460+
1461+
Returns
1462+
-------
1463+
iterable
1464+
Iterable of tuples containing the (index, value) pairs from a
1465+
Series.
1466+
1467+
See Also
1468+
--------
1469+
DataFrame.iteritems : Equivalent to Series.iteritems for DataFrame.
1470+
1471+
Examples
1472+
--------
1473+
>>> s = pd.Series(['A', 'B', 'C'])
1474+
>>> for index, value in s.iteritems():
1475+
... print("Index : {}, Value : {}".format(index, value))
1476+
Index : 0, Value : A
1477+
Index : 1, Value : B
1478+
Index : 2, Value : C
14561479
"""
14571480
return zip(iter(self.index), iter(self))
14581481

0 commit comments

Comments
 (0)