pandas / 1 / reference / api / pandas.dataframe.isetitem.html

pandas.DataFrame.isetitem

DataFrame.isetitem(loc, value)[source]

Set the given value in the column with position ‘loc’.

This is a positional analogue to __setitem__.

Parameters
loc:int or sequence of ints
value:scalar or arraylike

Notes

Unlike frame.iloc[:, i] = value, frame.isetitem(loc, value) will _never_ try to set the values in place, but will always insert a new array.

In cases where frame.columns is unique, this is equivalent to frame[frame.columns[i]] = value.

© 2008–2022, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/1.5.0/reference/api/pandas.DataFrame.isetitem.html