Python Script

Hi everybody,

I have python script which runs in Spyder with no errors. But when I run it in KNIME through [Python Script 1->1] node, I get confusing errors.
In fact ‘ta’ library generates financial indicators for stock prices and I need to integrate it in KNIME.

this is the python code:

import ta
import pandas as pd
df = pd.read_csv(“stock.txt”, sep = “,”)
ta.add_all_ta_features(df, “Open”,“High”, “Low”, “Close”, “Vol”, False, “”)

in Knime, I have inserted the below script in Python Script node:

import ta
output_table = input_table.copy()
ta.add_all_ta_features(output_table, “Open”,“High”, “Low”, “Close”, “Vol”, False, “”)

I appreciate any help

Hi @jalilsh -

What errors are you seeing? Can you provide those, or a bit of the relevant log?

Also, as a quick check, can you make sure that that output of your code is a pandas dataframe? This is required for the node to execute properly.


I set up this example with data from the website of the package ta. Maybe you take a look.


Hi @mlauber71,

thanks for your reply. This is the error I get with my code

My workflow and the text data is as below:Add Indicators.knwf (7.7 KB) Test.txt (180.6 KB)

It is interesting. I get similar error with the workflow you provided. Maybe there is something wrong with Python environment settings

I was able to run your workflow without problems. I attached it including the results.

Add Indicators2.knwf (2.3 MB)

I think you would have to check your Python environment.

Some short steps and hints:

The official guide:


thanks a lot.
in fact it was a problem with Python environment. the required library was not accessible to KNIME at first.

I tried to run the scripting with all the columns and it didn’t work, then I filtered the columns you wanted and then I created a new column to test and it worked as the image shows.

1 Like