Convert string to date type using python script in knimw


I am trying to convert the column with date in string format to date format “yyyy-mm-dd”. But, this column has some missing/invalid values. So, to handle such missing/invalid values, I am using “to_datetime” function of the python with the parameter “errors=ignore/coerce”. Using this, I am getting the output column with valid date values and NaT value (in case value is missing or is invalid).
The code is running fine inside the “python script” node, by clicking on “Exceute Script”. But, when I am running by right clicking the “python script” node and clicking on “Ececute”, it is throwing the error “NaTType does not support tzname”.
Please provide any solution to this.

Have you considered using KNIME’s own or other date and time functions.

Is there a specific reason to use python? And if so could you provide an example demonstrating this error?