I've got a function
def do_something(input_data, column: int):
# Do something with one column of the data
Now I need to create a kedro node, but I can't do node(do_something, ["input_data", 1], "output")
. How can I put the constant value (1) into the node?
One approach would be to pass the data via params. Add column_number: 1
to the parameters.yaml file, and then your node definition would look like node(do_something ["input_data", "params:column_number"], "output")
.
If you need to reuse the same function in many nodes, changing the column, then it will not work easily. Instead you can use partial, something like node(partial(do_something, column=1), "input_data", "output"])