Merge Table

../../../../_images/merge.svg

Merge tables on a shared index column

Documentation

Merge table on a shared index column in input A and input B.

A specific index can be present in either A or B, or in both A and B. The join operation determines which rows to include in the output.

  • Intersection, output rows in A x B (cartesian product), where the two indices match. Corresponds to an intersection of indices from both A and B.

  • Index from A, output rows with index present in A and not in B. Also includes the intersection.

  • Index from B, output rows with index present in B and not in A. Also includes the intersection.

  • Union, output the rows for index from A, index from B and the intersection (once). Corresponds to a union of indices from both A and B.

Output contains the index column (once) and one additional column for each column in A and in B. Column names, except the index, that appear in both A and B are made unique by adding a suffix. Rows with an index that is only present in either of A or B will contain masked values (or NaN) in columns missing data.

Example

Suffix A:

_A

Suffix B:

_B

A:

Id

Price

Inventory

0

10

5

1

15

0

2

25

2

B:

Id

Sold

Price

1

1

10

1

4

15

2

3

25

3

1

45

Intersection:

Id

Price_A

Inventory

Sold

Price_B

1

15

0

1

10

1

15

0

4

15

2

25

2

3

25

Index from A:

Id

Price_A

Inventory

Sold

Price_B

0

10

5

NaN

NaN

… 3 intersection rows

Index from B:

Id

Price_A

Inventory

Sold

Price_B

… 3 intersection rows

3

NaN

NaN

1

45

Union:

Id

Price_A

Inventory

Sold

Price_B

0

10

5

NaN

NaN

… 3 intersection rows

3

NaN

NaN

1

45

Definition

Input ports

Input A table

Input A

Input B table

Input B

Output ports

Output table

Output

Configuration

Index column (index)

Index to join on, should exist in both input A and B.

Join operation (operation)

Join operation, determines which rows to output.

Suffix A (suffix_a)

Suffix for column names in A appearing in both A and B.

Suffix B (suffix_b)

Suffix for column names in B appearing in both A and B.

Examples

Implementation

class node_merge_tables.MergeTable[source]