-2

The int passed makes a 3 element 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.]] 
kb9alpp
  • 107
  • 8
  • What you're describing doesn't match the documentation. Exactly what version of numpy are you running? – Dai Dec 12 '21 at 01:12
  • 5
    You must be calling that function twice, and yes, the shape returned looks correct if you ignore the duplicates, maybe check the documentation to verify? – Trash Can Dec 12 '21 at 01:13
  • 1
    @user17242583 [removed] thank you. Meme Composer, Dai still working on determining what is causative to my output based on both suggestions. Thank you both as well. – kb9alpp Dec 12 '21 at 01:37
  • Will you please send a _screenshot_ of the output? (Funny because we usually tell users _not_ to do that :) –  Dec 12 '21 at 01:47

2 Answers2

0

The name of the file was originally array.py. Changing this name fixed the issue. This post helped. link

kb9alpp
  • 107
  • 8
-1

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.]])
hpaulj
  • 221,503
  • 14
  • 230
  • 353
  • Results after moving to Jupyter or interpreted (from vim) are absolutely as they should be. Thank you. – kb9alpp Dec 12 '21 at 02:43