I do some calculations with two 2D array with two for loop.
The answer I got are several seperate numbers.
Is there any method that I can turn the answers into one 2D array? Like this:
[[6.0, 10.9], [24.0, 33.8]]
This is my code:
import numpy as np
for i in range(1, 3):
arr2d_1 = np.array([[1, 2, 3], [4, 5, 6]])
arr2d_2 = np.array([[2, 2, 2], [2, 2, 2]])
for j in range(0,2):
res = (arr2d_1*i+arr2d_2*j)/arr2d_1*i
sum_res = np.sum(res)
print(sum_res)
This is the result:
6.0
10.900000000000002
24.0
33.8