calculate
Evaluates a formula containing basic arithmetic over a dataset’s columns.
For example, to multiply column A
by two and add column Col B
, you would simply write
For more details regarding valids operators etc. see the Pandas eval() documentation, more specifically the supported syntax, and eval() applied to DataFrames.
Note that assignments in the formula are not supported, since the result must always be a new column,
i.e. the following kind of formula should be avoided: "c = a + b"
. The correct way to return the result
as a column would simply be "a + b"
.
If the name of an input column contains spaces, such as in the example above, it should be quoted in single backticks.
Was this page helpful?