Project: Compute a function value as a new field¶
- class txf.Project(source, inputs, output, function)¶
The
Project
transform computes (projects) a new field using an arbitrary function of zero or more input fields.- inputs: tuple(str) or str¶
The fields to combine. They will not be dropped from the output. Note that nullary functions are supported.
- output: str¶
The field containing the computed result.
- function: callable¶
A callable implementing the function. It will be given the values of inputs as positional arguments in the given order.
Usage¶
Project(p, 'Number', 'Square', lambda x: x*x)
Project(p, () 'Roll', rand.randint(1,6))