The int passed makes a 3x3, 2-D array.
np.zeros(3)
But it makes a 3 column array with 2 rows.
[0. 0. 0.]
[0. 0. 0.]
What's the reason behind this? And when I pass a shape of (3,3) to np.zero()'s shape it makes even less sense. 2 of them? Looking into a duplication issue here.
[[0. 0. 0.]
[0. 0. 0.]
[0. 0. 0.]]
[[0. 0. 0.]
[0. 0. 0.]
[0. 0. 0.]]
CodePudding user response:
Normal output:
In [430]: np.zeros(3)
Out[430]: array([0., 0., 0.])
In [431]: np.zeros((3,3))
Out[431]:
array([[0., 0., 0.],
[0., 0., 0.],
[0., 0., 0.]])
CodePudding user response:
The name of the file was originally array.py. Changing this name fixed the issue. This post helped. link