I need help for my code. I have two arrays, one obtained randomly.
For example: Let’s say the two arrays are:
randm and r_q
randm = [1 0 1]
r_q = [[3 5 2]
[5 4 3]
[5 2 2]]
By multiplying the values above and transposing its product, I got:
multi_trans_output = [[3 0 5]
[5 0 2]
[2 0 2]]
What I need to do now is to store the values in multi_trans_output into another arrays like:
r1 = [3 0 5]
r2 = [5 0 2]
r3 = [2 0 2]
Then get their sums:
r1_sum = [8]
r2_sum = [7]
r3_sum = [4]
So far, my code looks like this:
multi_trans_output = populations*r_q_active.T
# loop for storing of values in r(x)
for d in multiplied_output:
.
.
print(r(x))
r(x)_sum = numpy.sum(r(x), axis=1)
Any help/suggestion would be very much appreciated! Thanks in advance.
pandas. These are standard transformations for this module.np.sum(randm*r_q.T,axis=1)?