I am relatively new to NiFi and am not sure how to do the following correctly. I would like to use ExecuteScript
processor (script engine: python) to do the following (only in python please):
1) There is a CSV file containing the following information (the first row is the header):
first,second,third
1,4,9
7,5,2
3,8,7
2) I would like to find the sum of individual rows and generate a final file with a modified header. The final file should look like this:
first,second,third,total
1,4,9,14
7,5,2,14
3,8,7,18
For the python script, I wrote:
def summation(first,second,third):
numbers = first + second + third
return numbers
flowFile = session.get()
if (flowFile != None):
flowFile = session.write(flowFile, summation())
But it does not work and I am not sure how to fix this. Can anyone provide me an understanding on how to approach this problem?
The NiFi flow:
![79545-nififlow.png 79545-nififlow.png](https://community.cloudera.com/t5/image/serverpage/image-id/18068i820FF9D84E621EC3/image-size/medium?v=v2&px=400)