Python Script Node changes accuracy of floats

I have an input table which is containing a string column that contains actually floats.

The only thing I want is to have the exact same output out of the python node as it was in the input (column type string, e.g. trailing 0 included).

Where is the type getting changed and what can I do about it?test_python_float.knwf (6.5 KB)

image

Hi @tbtt

I have just run your example workflow and I do not get a type conversion. Here below the result I get from the output of your Python node with code :

# Copy input to output
output_table = input_table.astype({‘column1’: ‘object’}).copy()

Result:

test_pyton_float_result_snapshot

It is the exact same output out of the python node as it was in the input (column type string, e.g. trailing 0 included).

Hope this is of help.

Best regards

Ael

1 Like

Hey @aworker, yes it kinda helped, yesterday I changed the Serilization library in the KNIME Settings, I thought I already restored it to the default, but turns out I didnt :confused:. Thanks!

2 Likes

Hi @tbtt,

What serialization library did you use when you encountered the type change? Then we can open a bug report for that.

Marcel

1 Like

Hey Marcel,

it was the CSV (Experimental) serialization.

Thanks!

3 Likes

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