0

Hi I have to execute below python code in apache nifi and my nifi flow is as below
 my python code is as below (I have ruined it locally it is working fine)

`

import pandas as pd
 cdr = pd.read_csv("cdr.csv")
 labels = pd.read_csv("result.csv")
 cdr.rename(mapper={str(value[0]):n for n,value in labels.to_dict(orient='list').items()},  axis=1, inplace=True)

and my nifi flow :- enter image description here

Here cdr comes from GETSFTP and labels comes from get file processor and here cdr data will come continuously

can anyone help me to write above python code in ExecuteScript processor in nifi

iDeveloper
  • 1,699
  • 22
  • 47
venkatesh
  • 13
  • 5
  • it will be easier to use [ExecuteStreamCommand](https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.6.0/org.apache.nifi.processors.standard.ExecuteStreamCommand/index.html) - it allows to read from STDIN and write to STDOUT. but in this case python must be installed near nifi. if you still want to use ExecuteScript I advice you to start from this article: https://community.hortonworks.com/articles/75032/executescript-cookbook-part-1.html – daggett Jun 20 '19 at 07:37

1 Answers1

0

The ExecuteScript processor cannot use native Python modules, only Jython code. Try using ExecuteStreamCommand to run arbitrary Python code.

Andy
  • 13,916
  • 1
  • 36
  • 78