[Numpy-discussion] About asarray (list)

Claude Gouedard cgoued@gmail....
Wed Aug 27 09:48:48 CDT 2008


Hi ,

I'm just surprised by the behaviour of numpy.asarray on  lists.

Can someone comment this :
=====================
a=(1)
aa=asarray(a)
print  aa.size , aa.shape
>> 1   ( )
=====================

The shape  doesnot reflect the actual size.

If a=(1,2)  there is no problem .
=====================
aa=asarray((1,2))
print  aa.size , aa.shape
>> 2   (2, )
=====================
... same  for sequences:
=====================
aa=asarray( [1] )
 print  aa.size , aa.shape
>> 1  (1, )
=====================

Thanks
Claude Gouedard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20080827/a9e3fafc/attachment.html 


More information about the Numpy-discussion mailing list