Skip to content

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

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


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

Choose a reason for hiding this comment

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

Selects -> Select

Copy link
Member

Choose a reason for hiding this comment

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

BTW, I think "Select" is not the correct term, as you can also use this to set values


Similarly to ``iloc``, ``iat`` provides **integer** based lookups.
You can also set using these indexers.
Useful if performance is a major concern and you only need to
Copy link
Member

Choose a reason for hiding this comment

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

I would be a bit more careful with "major concern", as if performance is really important, you typically should not use this indexer many times. But, it is certainly useful to mention that iat is faster than iloc when you know you want to access only a single scalar.

get or set a value at a particular row/column.

See Also
--------
at : Selects a single value for a row/column label pair
Copy link
Member

Choose a reason for hiding this comment

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

I think we will need to do DataFrame.at to make the automatic link work (and the same for the others below)

loc : Selects a group of rows and columns by label(s)
iloc : Selects group of rows and columns by integer position(s)

Returns
Copy link
Contributor

Choose a reason for hiding this comment

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

You can omit the returns section if there's no return value

-------
None

Examples
--------
>>> df = pd.DataFrame([[0,2,3], [0,4,1], [10,20,30]])
Copy link
Contributor

Choose a reason for hiding this comment

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

pep8: spaces after comma.

Copy link
Member

Choose a reason for hiding this comment

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

Also, can you specify string column names? eg columns=['A', 'B', 'C']
to make it clear that it is position based (with the integer indexes it is dubious)

>>> df
0 1 2
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