I am new to Knime and need a quick pointer to Python script - how to loop over each row?
Sales Quantity Revenue
How to read the input table and loop over Revenue for Sales x Quantity = Revenue?
I find some examples of python scripting is invalid and cannot give insights.
Tables in KNIME’s Python snippet nodes (e.g., input_table and output_table in the Python Script (1⇒1) node) are represented as pandas DataFrames. Please refer to the pandas documentation or other related resources (e.g., this one) to find out how to use DataFrames.
Would you mind pointing to these examples and possibly describe what problems you experienced with them? Then we can review them for correctness. Thanks!
Thanks, you pointed me to right direction.
I was running the example in 07_Scripting/03_Python/03_Fetch_ChEMBL_Target_Data and get an error message when running Retreive assays, activities, and targets nodes.
ERROR PostgreSQL Connector 5:238:0:236 Execute failed: Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
Glad I could help!
Yes, this is probably not a good fit for an introductory example of how to use Python in KNIME. It requires you to have a specific database server running and to provide the connection information to that server to some nodes in the workflow (this is also stated in the yellow-bordered workflow annotation box at the top of the workflow).
In fact, there are, unfortunately, no really basic examples in the 07_Scripting/03_Python directory of our examples server, at least not yet. Perhaps searching the KNIME Hub can help you find better suited example workflows provided by the community, for the time being.