diff --git a/doc/source/reference/frame.rst b/doc/source/reference/frame.rst index 31a1c6008bce8..7680c8b434866 100644 --- a/doc/source/reference/frame.rst +++ b/doc/source/reference/frame.rst @@ -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 `. diff --git a/pandas/core/frame.py b/pandas/core/frame.py index e5d424b15e69e..f530466c0fc30 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -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 @@ -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):