Is there an equivalent to the MATLAB
size()
command in Numpy?
In MATLAB,
>>> a = zeros(2,5)
0 0 0 0 0
0 0 0 0 0
>>> size(a)
2 5
In Python,
>>> a = zeros((2,5))
>>>
array([[ 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0.]])
>>> ?????
shape
is an attribute of arrays and a function in the numpy model but not a method of array objects. Is there an obvious answer? Does it feel like it merits a separate SO question, or is it too potentially opinion-based? – Ben Bolker Feb 25 '15 at 18:13