Skip to content

Commit 080ef0c

Browse files
akoselTomAugspurger
authored andcommitted
DOC: update the DataFrame.iat[] docstring (pandas-dev#20219)
* DOC: update the DataFrame.iat[] docstring * Update based on PR comments * Update based on PR comments * Singular not plural * Update to account for use with Series. Add example using Series. * Update indexing.py * PEP8
1 parent 302fda4 commit 080ef0c

File tree

1 file changed

+41
-3
lines changed

1 file changed

+41
-3
lines changed

pandas/core/indexing.py

+41-3
Original file line numberDiff line numberDiff line change
@@ -1920,11 +1920,49 @@ def _convert_key(self, key, is_setter=False):
19201920

19211921

19221922
class _iAtIndexer(_ScalarAccessIndexer):
1923-
"""Fast integer location scalar accessor.
1923+
"""
1924+
Access a single value for a row/column pair by integer position.
19241925
1925-
Similarly to ``iloc``, ``iat`` provides **integer** based lookups.
1926-
You can also set using these indexers.
1926+
Similar to ``iloc``, in that both provide integer-based lookups. Use
1927+
``iat`` if you only need to get or set a single value in a DataFrame
1928+
or Series.
1929+
1930+
See Also
1931+
--------
1932+
DataFrame.at : Access a single value for a row/column label pair
1933+
DataFrame.loc : Access a group of rows and columns by label(s)
1934+
DataFrame.iloc : Access a group of rows and columns by integer position(s)
1935+
1936+
Examples
1937+
--------
1938+
>>> df = pd.DataFrame([[0, 2, 3], [0, 4, 1], [10, 20, 30]],
1939+
... columns=['A', 'B', 'C'])
1940+
>>> df
1941+
A B C
1942+
0 0 2 3
1943+
1 0 4 1
1944+
2 10 20 30
1945+
1946+
Get value at specified row/column pair
19271947
1948+
>>> df.iat[1, 2]
1949+
1
1950+
1951+
Set value at specified row/column pair
1952+
1953+
>>> df.iat[1, 2] = 10
1954+
>>> df.iat[1, 2]
1955+
10
1956+
1957+
Get value within a series
1958+
1959+
>>> df.loc[0].iat[1]
1960+
2
1961+
1962+
Raises
1963+
------
1964+
IndexError
1965+
When integer position is out of bounds
19281966
"""
19291967

19301968
_takeable = True

0 commit comments

Comments
 (0)