Skip to content
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

DOC: update the DataFrame.iat[] docstring #20219

Merged
merged 7 commits into from
Mar 11, 2018
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
29 changes: 26 additions & 3 deletions pandas/core/indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -1920,11 +1920,34 @@ def _convert_key(self, key, is_setter=False):


class _iAtIndexer(_ScalarAccessIndexer):
"""Fast integer location scalar accessor.
"""
Access a single value for a row/column pair by integer position.

Similarly to ``iloc``, ``iat`` provides **integer** based lookups.
You can also set using these indexers.
Similar to ``iloc``, in that both provide integer-based lookups. Use
Copy link
Contributor

Choose a reason for hiding this comment

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

this also works on a Series, can you re-word to accomodate

Copy link
Contributor Author

@akosel akosel Mar 10, 2018

Choose a reason for hiding this comment

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

Great point, I specified that iat works for both a DataFrame and a Series (below the comment, so Github isn't collapsing it here). Let me know if you want be to reword it any differently. I also added an example for using it on Series.

``iat`` if you only need to get or set a single value in a DataFrame.

See Also
--------
DataFrame.at : Access a single value for a row/column label pair
DataFrame.loc : Access a group of rows and columns by label(s)
DataFrame.iloc : Access a group of rows and columns by integer position(s)

Examples
--------
>>> df = pd.DataFrame([[0, 2, 3], [0, 4, 1], [10, 20, 30]],
... columns=['A', 'B', 'C'])
>>> df
A B C
0 0 2 3
1 0 4 1
2 10 20 30

>>> df.iat[1, 2]
1

>>> df.iat[1, 2] = 10
>>> df.iat[1, 2]
10
"""

_takeable = True
Expand Down