How to execute Jupyter notebook

Hello.

I was wondering about how to execute jupyter notebook in KNIME workflow.
Here is my example jupyter notebook code.

[python_test.ipynb]
import pandas as pd
data = [[‘Choi’,22],[‘Kim’,48],[‘Joo’,32]]
df = pd.DataFrame(data, columns=[‘Name’,‘Age’])
df.to_csv(r’C:\Users\khhfh\result.csv’)

And here is my code in Python Script node.

[Python Script node]
'# Path to the folder containing the notebook, e.g. the folder ‘data’ contained
'# in my workflow folder
notebook_directory = r"C:\Users\khhfh\OneDrive\바탕 화면\test"

'# Filename of the notebook
notebook_name = “python_test.ipynb”

'# Load the notebook as a Python module
my_notebook = knime_jupyter.load_notebook(notebook_directory, notebook_name)

I expected that when I loaded the ipynb file, then ‘result.csv’ would be created.
But nothing happend.

I’d appreciate it if you could tell me how to use ‘knime_jupyter’ library.

Thanks,
hhkim

@hhkim you could check this example how to use KNIME and Jupyter. And also how to transfer files between them.

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.