[Numpy-discussion] problem: I get an array that doesn't have a length

Pierre GM pgmdevlist at gmail.com
Wed May 2 09:52:08 EDT 2007


Mark,
In your example:
> >>> b = asarray(3,'d')

b is really a numpy scalar, so it doesn't have a length. But it does have a 
size (1) and a ndim (0).
If you need to have arrays with a length, you can force the array to have a 
dimension 1 with atleast_1d(b) or array(b,copy=False,ndmin=1)



More information about the NumPy-Discussion mailing list