VSplit Table

../../../../_images/vsplit_table.svg

Split Table row wise (vertically), grouping unique values of an index column.

Documentation

If “One table for each row” is used each row in the input will result in a table with one row in the output list. So if the input table had N rows the output list will contain N Table items, each with only a single row.

If “One table for each row” is unchecked and an index column is specified the split will instead be performed according to the values in this column. All rows with the same value in the index column will be grouped together into one output table.

An example of an index column can be created by VJoin Table. With this option enabled rows that originate from the same incoming Table will be given the same index, making it easy to “undo” a vjoin operation with a vsplit node.

If index column is missing

If an index column has been specified, but that column is missing in an input table, “Action on missing Index” will control the behavior.

If the selected action is “Error”, the node will give an error if the selected index column is missing. This is very useful for finding cases where the index column wasn’t intended to be missing.

If the selected action is “Single table, one table for all rows”, the node will fall back to simply forwarding the entire input table to the output list is the index column is missing.

If the selected action is “Multiple tables, one for each row”, the node will fall back to splitting the input as if “One table for each row was selected.”

Remove complement columns

Yet another available option in the node is to remove columns that after the split contain only NaNs or empty strings. This is called “Remove complement columns” in the configuration GUI and is (loosly speaking) the reversal of the creation of complements for missing columns preformed by the VJoin Table node. After using this option, the output Tables can have different numbers of columns.

Splitting on multiple columns

In the configuration gui you can only select a single column to split on, but this limitation is easy to work around. To split on unique combinations of two columns, simply put one VSplit Table and one VSplit Tables in series, configured to split on one of the columns each. To split on unique combinations of values in even more columns, just add more VSplit Tables nodes. See example flow.

Definition

Input ports

port1 table

Input Table

Output ports

port1 [table]

Split Tables

Configuration

Index column (input_index)

Choose name for index column. All rows with the same value in this column will end up in the same output table.

Action on missing index (missing_index)

Choose how to handle tables where the selected index column is missing.

One table for each row (no_index)

If checked, each row in the input table will be put in a different table in the output. If unchecked, you need to specify an index column which will then be used to determine what rows go in which table.

Remove complement columns (remove_fill)

After splitting, remove columns that contain only NaN or empty strings.

Examples

Implementation

class node_vsplit_tables.VSplitTableNode[source]