Skip to content

DOC: Improve the docsting of Series.iteritems #24879

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Mar 19, 2019
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -1446,6 +1446,30 @@ def to_string(self, buf=None, na_rep='NaN', float_format=None, header=True,
def iteritems(self):
"""
Lazily iterate over (index, value) tuples.

This method returns an iterable tuple (index, value). This is
convienient if you want to create a a Lazy iterator.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are 2 as on this line. Lowercase l on Lazy


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

See Also
--------
Series.apply : Invoke function on values of Series.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if Series.apply and Series.map are too related to this method. I would instead reference Series.items

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless I am mistaken, it seems to me that Series.iteritems and Series.items are the same method. The docstring of items and iteritems will be the same I don't think that this is a good idea.

I will mention it in the description instead.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that apply and map aren't closely enough related to include here - can you remove?

Series.map : Map values of Series according to input correspondence.
DataFrame.iteritems : Equivalent to Series.iteritems for DataFrame.

Examples
--------
>>> s = pd.Series(['A', 'B', 'C'])
>>> for index, value in s.iteritems():
... print("Index : {}, Value : {}".format(index, value))
Index : 0, Value : A
Index : 1, Value : B
Index : 2, Value : C
"""
return zip(iter(self.index), iter(self))

Expand Down