Type conversion issue from Python to KNIME(Java)

In my python code I’m creating a numpy array per existing row and adding that array as new columns (2048) to the dataframe. The numpy array has a type of int64 which means Java Long. However most of the columns are converted to “Number(Integer)” columns. It seems only int64 columns that actually have a value that doesn’t fit into int32 are converted to “Number (Long)”.

This results in getting different column types depending on the input data which is further complicated by the fact there is no automated int -> long conversion option in KNIME.

I propose either of 2 fixes:

  • Python snippet should have an option to disable the “too clever” logic that infers the Java type so that int64 pandas columns are java longs
  • Supply a Integer to Long conversion node (like Double to Int)

The second option is probably easier and more generally useable.

In the meantime how can I convert thousands of int columns to long? Table Manipulator makes this all manual which is not an option.

Hello @kienerj,

Try Number To String and follow it up with String To Number node which has option to create Long columns.