update method creates a new table containing a new, in-memory column for each argument.
update, the new columns are evaluated and stored in memory. Existing columns are referenced without additional memory allocation.
- all the source columns are desired in the result,
- the formula is expensive to evaluate,
- cells are accessed many times, and/or
- a large amount of memory is available.
When memory usage or computation needs to be reduced, consider using
lazy_update. These methods have different memory and computation expenses.
Formulas to compute columns in the new table; e.g.,
A new table that includes all the original columns from the source table and the newly defined in-memory columns.
In the following example, the new columns (
Y) allocate memory and are immediately populated with values. Columns
C refer to columns in the source table and do not allocate memory.
from deephaven import new_table
from deephaven.column import string_col, int_col
source = new_table([
string_col("A", ["The", "At", "Is", "On"]),
int_col("B", [1, 2, 3, 4]),
int_col("C", [5, 6, 7, 8])
result = source.update(formulas=["A", "X = B", "Y = sqrt(C)"])