I have two matrices of features, that have different number of rows. Suppose matrix A has more rows than matrix B. The columns of matrices includes ID1, ID2, Time_slice, feature value. Since for some Time_slice there is no feature value in B, the number of rows in B is less than A. I require to find which rows are missed in B. Then add rows to B with related ID1, ID2 values, and zero for the feature.
ID1 ID2 Time_slice Feature
A= array([[ 100, 1., 0., 1.5],
[ 100, 1., 1., 3.7],
[ 100, 2., 0., 1.2],
[ 100, 2., 1., 1.8],
[ 100, 2., 2., 2.9],
[ 101, 3., 0., 1.5],
[ 101, 3., 1., 3.7],
[ 101, 4., 0., 1.2],
[ 101, 4., 1., 1.8],
[ 101, 4., 2., 2.9]])
B= array([[ 100, 1., 0., 1.25],
[ 100, 1., 1., 3.37],
[ 100, 2., 0., 1.42],
[ 100, 2., 1., 1.68]])
Output should be as follow:
[[ 100, 1., 0., 1.25],
[ 100, 1., 1., 3.37],
[ 100, 2., 0., 1.42],
[ 100, 2., 1., 1.68],
[ 100, 2., 2., 0 ],
[ 101, 3., 0., 0],
[ 101, 3., 1., 0],
[ 101, 4., 0., 0],
[ 101, 4., 1., 0],
[ 101, 4., 2., 0]])