Rename columns in Tables with Table

../../../../../_images/rename_columns.svg

Rename columns in Tables by using an additional Table as a dictionary.

The dictionary Table must include one column with keywords and another column with replacements. When the node is executed all column names in the input Tables are checked against keyword column in the ditionary Table. If a match is found the corresponding name in the replacement column will replace the original column name. For the case with no match the column names are left unchanged.

If a name appears more than once in the keywords column of the dictionary Table, that column will be renamed to each of the replacement names. Esentially copying the single input column to several columns in the output.

If a name appears more than once in the replacements column the last one that is also present in the data table will be used. Also note that renamed columns always take precedence over non-renamed ones.

Ref. nodes:Rename columns in Tables
Input ports:
dictionary:

table

Dictionary

tables:

[table]

Input Tables

Output ports:
tables:

[table]

Tables with renamed columns

Configuration:
Keyword column (source)
Name of column containing old names
Replacement column (destination)
Name of column containing new names

The columns in Tables are renamed by the nodes in this category. The renamed columns, together with not modified ones, are then located in the outgoing Tables.

The two nodes in the category provide different approaches to specify the input to the renaming process. One of the nodes uses an additional incoming Table as a dictionary while the other provides the possibility to specify regular expressions for search and replace. For more detailed information about the configuration of the nodes can be found in the documentation of the specific node.

class node_rename_columns.RenameTableColumnsTables[source]