Last answered:

04 Oct 2022

Posted on:

30 Nov 2021

2

What is the difference between a 0-d array and a scalar?

I thought they were the same thing until I saw the part at 4:21 where it says "This output is a 0-D array, rather than a scalar"
And then at 6:19 all the outputs (after using the squeeze method) returned as scalars. I am confused. Are 0-D arrays and scalars different?



imageimage

1 answers ( 0 marked as helpful)
Posted on:

04 Oct 2022

1

After some research, here is what I got
Mathematically, no, you can think of them as the same
However, from NumPy point of view, yes, they are different
please check this
why-are-0d-arrays-in-numpy-not-considered-scalar

Submit an answer