Skip to content

DOC: update the DataFrame.at[] docstring #20290

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 4 commits into from
Mar 12, 2018
Merged
Changes from all 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
45 changes: 42 additions & 3 deletions pandas/core/indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -1888,11 +1888,50 @@ def __setitem__(self, key, value):


class _AtIndexer(_ScalarAccessIndexer):
"""Fast label-based scalar accessor
"""
Access a single value for a row/column label pair.

Similar to ``loc``, in that both provide label-based lookups. Use
``at`` if you only need to get or set a single value in a DataFrame
or Series.

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

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

Get value at specified row/column pair

>>> df.at[4, 'B']
2

Set value at specified row/column pair

>>> df.at[4, 'B'] = 10
>>> df.at[4, 'B']
10

Similarly to ``loc``, ``at`` provides **label** based scalar lookups.
You can also set using these indexers.
Get value within a Series

>>> df.loc[5].at['B']
4

Raises
------
KeyError
When label does not exist in DataFrame
"""

_takeable = False
Expand Down