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
- locint or sequence of ints
Index position for the column.
- valuescalar or arraylike
Value(s) for the column.
Notes
frame.isetitem(loc, value)is an in-place method as it will modify the DataFrame in place (not returning a new object). In contrast toframe.iloc[:, i] = valuewhich will try to update the existing values in place,frame.isetitem(loc, value)will not update the values of the column itself in place, it will instead insert a new array.In cases where
frame.columnsis unique, this is equivalent toframe[frame.columns[i]] = value.