Code
import numpy as np
= np.array([[9, 9, 9, 9, 9]])
array_2d = np.array([1,1,1,1,1])
array_1d print(array_2d + array_1d)
print((array_2d+array_1d).shape)
[[10 10 10 10 10]]
(1, 5)
Let op - Open to thesis opportunities starting from January 2025. Having an exciting project in mind? Let us connect!
October 9, 2023
October 9, 2023
# To create 1D array (5,) aka list
array = [1, 2, 3, 4, 5]
# To create 2D array (5,1)
array = [[9],[9],[9],[9],[9]]
# To create 2D array (1,5)
array = [[9, 9, 9, 9, 9]]
[[10 10 10 10 10]]
(1, 5)
[[11 21 31 41 51]
[12 22 32 42 52]
[13 23 33 43 53]
[14 24 34 44 54]
[15 25 35 45 55]]
(5, 5)