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

**URL:** <https://forum.knime.com/t/python-script-date-column-converted-to-string-is-none/7929>\
**Category:** Community Extensions\
**Tags:** scripting-extensions\
**Created:** [November 17, 2015, 2:30pm UTC](https://forum.knime.com/t/python-script-date-column-converted-to-string-is-none/7929 "2015-11-17T14:30:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![KnimeLearner14](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/k/73ab20/32.png) [@KnimeLearner14](https://forum.knime.com/u/KnimeLearner14)\
**Post date:** [November 17, 2015, 2:30pm UTC](https://forum.knime.com/t/python-script-date-column-converted-to-string-is-none/7929/1 "2015-11-17T14:30:27Z")

</div>

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_ |

&nbsp;

Python Scripting-&nbsp; 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&nbsp; DateAndTimeCell&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Second is a time field, which is not supported by this instance!  
WARN&nbsp; DateAndTimeCell&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Milliseconds are not supported by this instance!  
WARN&nbsp; DateAndTimeCell&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Hour is a time field, which is not supported by this instance!  
WARN&nbsp; DateAndTimeCell&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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.

&nbsp;

Best regards,

Martin

---

<div class="post-metadata">

**Author:** ![niederle](https://forum-cdn.knime.com/user_avatar/forum.knime.com/niederle/32/42_2.png) [@niederle](https://forum.knime.com/u/niederle)\
**Post date:** [November 19, 2015, 9:19am UTC](https://forum.knime.com/t/python-script-date-column-converted-to-string-is-none/7929/2 "2015-11-19T09:19:42Z")

</div>

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.

&nbsp;

---

<div class="post-metadata">

**Author:** ![KnimeLearner14](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/k/73ab20/32.png) [@KnimeLearner14](https://forum.knime.com/u/KnimeLearner14)\
**Post date:** [November 19, 2015, 10:10am UTC](https://forum.knime.com/t/python-script-date-column-converted-to-string-is-none/7929/3 "2015-11-19T10:10:58Z")

</div>

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()
```

&nbsp;

**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)]
```

&nbsp;

&nbsp;

Thanks.

Martin

---

<div class="post-metadata">

**Author:** ![mbloechle](https://forum-cdn.knime.com/user_avatar/forum.knime.com/mbloechle/32/28814_2.png) [@mbloechle](https://forum.knime.com/u/mbloechle)\
**Post date:** [June 3, 2016, 2:35pm UTC](https://forum.knime.com/t/python-script-date-column-converted-to-string-is-none/7929/4 "2016-06-03T14:35:46Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![system](https://forum-cdn.knime.com/uploads/default/original/1X/ab3ccf34482a0329361734a18199390177204f15.png) [@system](https://forum.knime.com/u/system)\
**Post date:** [April 21, 2023, 9:29pm UTC](https://forum.knime.com/t/python-script-date-column-converted-to-string-is-none/7929/5 "2023-04-21T21:29:08Z")

</div>

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