Skip to content
Prev Previous commit
Next Next commit
Update to account for use with Series. Add example using Series.
  • Loading branch information
akosel committed Mar 10, 2018
commit 88c23c0373335bc0faf82da092990e715c2d4cee
17 changes: 16 additions & 1 deletion pandas/core/indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -1924,7 +1924,8 @@ class _iAtIndexer(_ScalarAccessIndexer):
Access a single value for a row/column pair by integer position.

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.
``iat`` if you only need to get or set a single value in a ``DataFrame``
or ``Series``.

See Also
--------
Expand All @@ -1942,12 +1943,26 @@ class _iAtIndexer(_ScalarAccessIndexer):
1 0 4 1
2 10 20 30

Get value at specified row/column pair

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

Set value at specified row/column pair

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

Get value within a series

>>> df.loc[0].iat[1]
2

Raises
------
IndexError
When integer position is out of bounds
"""

_takeable = True
Expand Down