I am bit confused between both the methods : concatenate and stack
The concatenate and stack provides exactly same output , what is the difference between both of them ?
Using : concatenate
import numpy as np
my_arr_1 = np.array([ [1,4] , [2,7] ])
my_arr_2 = np.array([ [0,5] , [3,8] ])
join_array=np.concatenate((my_arr_1,my_arr_2),axis=0)
print(join_array)
Using : stack
import numpy as np
my_arr_1 = np.array([ [1,4] , [2,7] ])
my_arr_2 = np.array([ [0,5] , [3,8] ])
join1_array=np.stack((my_arr_1,my_arr_2),axis=0)
print(join1_array)
Output for both is same :
[[[1 4]
[2 7]]
[[0 5]
[3 8]]]