Skip to content

Commit dae1781

Browse files
luke396mroeschke
authored andcommitted
DOC: Add DataFrame.isetitem method (pandas-dev#57614)
* 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]>
1 parent 9d8fd24 commit dae1781

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

doc/source/reference/frame.rst

+1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ Indexing, iteration
7474
DataFrame.where
7575
DataFrame.mask
7676
DataFrame.query
77+
DataFrame.isetitem
7778

7879
For more information on ``.at``, ``.iat``, ``.loc``, and
7980
``.iloc``, see the :ref:`indexing documentation <indexing>`.

pandas/core/frame.py

+14
Original file line numberDiff line numberDiff line change
@@ -4018,6 +4018,11 @@ def isetitem(self, loc, value) -> None:
40184018
value : scalar or arraylike
40194019
Value(s) for the column.
40204020
4021+
See Also
4022+
--------
4023+
DataFrame.iloc : Purely integer-location based indexing for selection by
4024+
position.
4025+
40214026
Notes
40224027
-----
40234028
``frame.isetitem(loc, value)`` is an in-place method as it will
@@ -4028,6 +4033,15 @@ def isetitem(self, loc, value) -> None:
40284033
40294034
In cases where ``frame.columns`` is unique, this is equivalent to
40304035
``frame[frame.columns[i]] = value``.
4036+
4037+
Examples
4038+
--------
4039+
>>> df = pd.DataFrame({"A": [1, 2], "B": [3, 4]})
4040+
>>> df.isetitem(1, [5, 6])
4041+
>>> df
4042+
A B
4043+
0 1 5
4044+
1 2 6
40314045
"""
40324046
if isinstance(value, DataFrame):
40334047
if is_integer(loc):

0 commit comments

Comments
 (0)