Skip to content

Commit

Permalink
DOC: Add DataFrame.isetitem method (pandas-dev#57614)
Browse files Browse the repository at this point in the history
* Add DataFrame.isetitem method

* Add See-Also and Examples

* Fix orfer

* Update pandas/core/frame.py

Co-authored-by: Matthew Roeschke <[email protected]>

---------

Co-authored-by: Matthew Roeschke <[email protected]>
  • Loading branch information
2 people authored and pmhatre1 committed May 7, 2024
1 parent 9d8fd24 commit dae1781
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions doc/source/reference/frame.rst
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ Indexing, iteration
DataFrame.where
DataFrame.mask
DataFrame.query
DataFrame.isetitem

For more information on ``.at``, ``.iat``, ``.loc``, and
``.iloc``, see the :ref:`indexing documentation <indexing>`.
Expand Down
14 changes: 14 additions & 0 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -4018,6 +4018,11 @@ def isetitem(self, loc, value) -> None:
value : scalar or arraylike
Value(s) for the column.
See Also
--------
DataFrame.iloc : Purely integer-location based indexing for selection by
position.
Notes
-----
``frame.isetitem(loc, value)`` is an in-place method as it will
Expand All @@ -4028,6 +4033,15 @@ def isetitem(self, loc, value) -> None:
In cases where ``frame.columns`` is unique, this is equivalent to
``frame[frame.columns[i]] = value``.
Examples
--------
>>> df = pd.DataFrame({"A": [1, 2], "B": [3, 4]})
>>> df.isetitem(1, [5, 6])
>>> df
A B
0 1 5
1 2 6
"""
if isinstance(value, DataFrame):
if is_integer(loc):
Expand Down

0 comments on commit dae1781

Please sign in to comment.