I want to multiply each column with a different number and update the values for this data frame.
The code I have written is:
for j in test.columns:
for i in r:
for k in range(len(p)):
test[i] = test[j].apply(lambda x:x*p[k])
p.remove(p[k])
break
r.remove(i)
break
And p is list of numbers that I want to multiply with.
p = [74, 46, 97, 2023, 364, 1012, 8, 242, 422, 78, 55, 90, 10, 44, 1, 3, 105, 354, 4, 26, 87, 18, 889, 9, 557, 630, 214, 1765, 760, 3344, 136, 26, 56, 10, 2, 2171, 125, 446, 174, 4, 174, 2, 80, 11, 160, 17, 72]
r is list of column names.
How to get rid of this error?


test = test * np.array(p)?