I have the following list:
ls = [[1,2,3], [3,4] , [5] , [7,8], [23], [90, 81]]
This is my numpy array:
array([[ 1, 0, 4, 3],
[ 10, 100, 1000, 10000]])
I need to multiply the values in the second row of my array by the length of the list in ls which is at the index of the corresponding number in the first row:
10 * len(ls[1]) & 100 * len(ls[0]) etc..
The objective output would be this array:
array([[ 1, 0, 4, 3],
[ 20, 300, 1000, 20000]])
Any efficient way doing this?