Skip to main content


Command Description

Merget two databases according to specific join type

Command Prototype

dtTable = Datatable.MergeDataTable(dtLeftTable,dtRightTable,strHow,strLeftKey,strRightKey,bSort)

Parameter Description

dtLeftTableTrueexpressionleftTableDatatable 1 to be merged
dtRightTableTrueexpressionrightTableDatatable 2 to be merged
strHowTrueenum"inner"The method to join two tables
strLeftKeyTruestring""Column name of the left table to use as the basis for joining
strRightKeyTruestring""Use column name of the right table as the basis for joining
bSortTruebooleanNoneWhen it is set as True, it means during merge the output is ordered by the specified column values(for example the left_on column value specified previously)


dtTable,The variable used to save the output of the command.


aryData = [["a", 1], ["b", 2], ["c", 3], ["d", 1]] 
aryColumns = ["letter", "number"]
objDatatable = Datatable.BuildDataTable(aryData,aryColumns)

aryData2 = [["a", 19], ["b", 20]]
aryColumns2 = ["letter", "age"]
objDatatable2 = Datatable.BuildDataTable(aryData2,aryColumns2)

dtTable = Datatable.MergeDataTable(objDatatable,objDatatable2,"outer","letter","letter",false)

letter number age
0 a 1 19.0
1 b 2 20.0
2 c 3 NaN
3 d 1 NaN