This methods updates values within the frame, or adds new columns to the frame.
All parameters have the same meaning as in the getter
DT[i, j, ...], with the only
j must select to columns by reference (i.e. there
could not be any computed columns there). On the other hand,
contain columns that do not exist in the frame yet: these columns will be
Column selector. Computed columns are forbidden, but not-existing (new) columns are allowed.
The replacement for the selection on the left-hand-side.
A simple python scalar can be assigned to any-shape selection on the LHS. If
iselects all rows (i.e. the assignment is of the form
DT[:, j] = R), then each column in
jwill be replaced with a constant column containing the value
If, on the other hand,
iselects only some rows, then the type of
Rmust be consistent with the type of column(s) selected in
j. In this case only cells in subset
[i, j]will be updated with the value of
R; the columns may be promoted within their ltype if the value of
Ris large in magnitude.
Assigning a type to one or more columns will change the types of those columns. The row selector
imust be “slice-all”
When a frame or an expression is assigned, then the shape of the RHS must match the shape of the LHS. Similarly to the assignment of scalars, types must be compatible when assigning to a subset of rows.
dt.update()– An alternative way to update values in the frame within
.replace()– Search and replace for certain values within the entire frame.
A simplified form of the setter, suitable for a single-column replacement.
In this case
j may only be an integer or a string.