Convert columns in Table


With the considered node it is possible to convert the data types of a number of selected columns in the incoming Table. In general, the columns in the internal Table type can have the same data types that exist for numpy arrays, except for numpy object type. For this node the list of available data types to convert to is restricted.

The following data types are available for conversion:
  • bool
  • float
  • int
  • str
  • unicode
  • datetime

Converting strings to datetimes

Converting a str/unicode column to datetime might require some extra thought if the strings include time-zone information. The datetimes stored by Sympathy have no time zone information (due to limitations in the underlying data libraries), but Sympathy is able to use the time-zone information when creating the datetime columns. This can be done in two different ways, which we call “UTC” and “naive”.

datetime (UTC)

The option datetime (UTC) will calculate the UTC-time corresponding to each datetime in the input column. This is especially useful when your data contains datetimes from different time zones (a common reason for this is daylight savings time), but when looking in the viewer, exports etc. the datetimes will not be the same as in the input.

For example the string '2016-01-01T12:00:00+0100' will be stored as 2016-01-01T11:00:00 which is the corresponding UTC time.

There is currently no standard way of converting these UTC datetimes back to the localized datetime strings with time-zone information.

datetime (naive)

The option datetime (naive) simply discards any time-zone information. This corresponds pretty well to how we “naively” think of time when looking at a clock on the wall.

For example the string '2016-01-01T12:00:00+0100' will be stored as 2016-01-01T12:00:00.

class node_convert_table_columns.ConvertTableColumns[source]

Convert selected columns in Table to new specified data types.

: Table

Table with data.

: Table

Table with converted columns.

Select columns :

Select column to convert.

Select type :

Select type to convert selected column to.

: button

Add selected combination of type and columns to the Conversions window.

: button

Remove selected item in Conversions window.

: button

Test listed conversions in the Conversions window.

Conversions :

Visualise definded conversions to perform when node is executed.