Hi @all,
I’d like to create lots of diagrams with python and I have to store the images within a knime-table.
Currently I use a Knime-Chunk-Loop to create with python all these diagrams (several python-views per row)
So I would prefer, to have one single pyhton-node, which creates the diagrams and put it into the dataframe.
This is the current python-script (does not work):
from io import BytesIO
import pandas as pd
import matplotlib.pylab as plt
data = input_table.copy()
for i, r in data.iterrows():
buffer = BytesIO()
# ....
fig.savefig(buffer, format='svg')
data.at[i, 'diag1'] = buffer.getvalue()
output_table = data
this is my current solution. but i would prefer to do all within one single python-node - cause this is much faster (every call on python-nodes need seconds, even if there are view data)…
OK next idea would be to store the images in a subfolder from Python and then use KNIME to loop over them and put them in a KNIME table. Admittedly not the most elegant way.
hm, not elegant, but possible. I’ll try…
But:
If I use buffer.get_value().decode("utf-8")
I’ll get the html-code of the svg-image into the knime-table at least…