danfojs icon indicating copy to clipboard operation
danfojs copied to clipboard

df.Merge with 2 different collection with different column length

Open Parthibanjj opened this issue 3 years ago • 0 comments

I have used examples in the site

const dfd = require("danfojs-node")

let data = [['K0', 'k0', 'A0', 'B0'], ['k0', 'K1', 'A1', 'B1'], ['K1', 'K0', 'A2', 'B2'], ['K2', 'K2', 'A3', 'B3']]

let data2 = [['K0', 'k0', 'C0' ], ['K1', 'K0', 'C1'], ['K1', 'K0', 'C2'] ['K2', 'K0', 'C3']]

let colum1 = ['Key1', 'Key2', 'A', 'B'] let colum2 = ['Key1', 'Key2', 'A']

let df1 = new dfd.DataFrame(data, { columns: colum1 }) let df2 = new dfd.DataFrame(data2, { columns: colum2 }) df1.print() df2.print()

let merge_df = dfd.merge({ "left": df1, "right": df2, "on": ["Key1"], how: "inner"}) merge_df.print()

   var _elem = arr[j][i];
                                  ^

TypeError: Cannot read properties of undefined (reading '0') at Utils.transposeArray (C:\Projects\PLR Node\node_modules\danfojs-node\dist\danfojs-base\shared\utils.js:154:39)

Parthibanjj avatar Aug 10 '22 13:08 Parthibanjj