Python Script - Date column (converted to string) is "None"

Hi guys,

I'm running Knime 2.12.1.

I'd like to code some stuff in the LAB-node "Python Script".

The input_table contains a date, represented as datatype "string". Converted with the "Column Rename" node from Date to string. The Output_Table of "Column Rename" is just fine... see for example:

2014-05-13
2014-05-13
2014-05-14
2014-05-14
2014-05-14

 

Python Scripting-  node Code:

output_table = input_table.copy()

BUT: Running my Python Script node there are a lot of warnings displayed and the process takes REALLY LONG!

WARNINGS in Console (I know they could be hidden, but I wanna be aware of whats happening there)

WARN  DateAndTimeCell                 Second is a time field, which is not supported by this instance!
WARN  DateAndTimeCell                 Milliseconds are not supported by this instance!
WARN  DateAndTimeCell                 Hour is a time field, which is not supported by this instance!
WARN  DateAndTimeCell                 Minute is a time field, which is not supported by this instance!

There is also a problem printing the input_table inside of the "Python Script" node to the console.

The "date"-column completly has value "None".

BEGIN_DATE
None     
None     
None     
None     
None  

Any ideas or solutions?

Thanks a lot.

 

Best regards,

Martin

Hi Martin,

could you please try to use the 'Time to String' node instead of the 'Rename' node to convert your time? If you look at the table specification of the output tables of both nodes you can see a difference. The 'Rename' node results in a column of type

Non-Native [interface org.knime.core.data.StringValue, interface org.knime.core.data.date.DateAndTimeValue, interface org.knime.core.data.DataValue, interface org.knime.core.data.BoundedValue]

The 'Time to String' node results in a column of type

StringCell

Both look like String-columns in the table view. (And I still don't know when people would need to change the column type via the 'Rename' node - I avoid this).

I hope this resolves the problems.

 

Hi niederle,

Thank you very much. Your tip with the date2string works great!

Can you imagine why the node took 30 sec for just 7% progress on a 400k Dataset with this simple code?

output_table = input_table.copy()

 

Meine Version:

print sys.version
2.7.10 |Anaconda 2.1.0 (64-bit)| (default, Sep 15 2015, 14:26:14) [MSC v.1500 64 bit (AMD64)]

 

 

Thanks.

Martin

I get the same warning (Milliseconds are not supported by this instance), so I tried putting time to string conversion in between. As a result the warnings disappear and I get a large speedup of 3.8x (312185ms vs. 82582ms) for 41k rows. However, my timestamp does not contain milliseconds (using the mask date node). Not sure this is expected behaviour? (Knime 3.1.2, Python 2.7.11)

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