[Numpy-discussion] array dtype=object problem

Christopher Fonnesbeck chris at trichech.us
Sat Jan 28 14:31:01 CST 2006

I am having trouble with numpy arrays that have (for some reason) an  
"object" dtype. All that happens in my code is that float values are  
appended to a multidimensional array, this array is transposed, and  
the transposed array is sent to matplotlib. Unfortunately, the array  
ends up being of type "object", which is not recognized by matplotlib:

(Pdb) y[:5]
array([575.060695363, 618.395159954, 817.767177867, 601.659726372,
        978.607427424], dtype=object)

(Pdb) scatter(x,y)
*** TypeError: function not supported for these types, and can't  
coerce safely to supported types

Moreover, this array, which clearly contains nothing but floats  
cannot be cast to a float array:

(Pdb) array(y,float)
*** TypeError: array cannot be safely cast to required type

Can anyone shed some light on this? I am utterly confused.


Christopher J. Fonnesbeck

Population Ecologist, Marine Mammal Section
Fish & Wildlife Research Institute (FWC)
St. Petersburg, FL

Adjunct Assistant Professor
Warnell School of Forest Resources
University of Georgia
Athens, GA

T: 727.235.5570
E: chris at trichech.us

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2417 bytes
Desc: not available
Url : http://projects.scipy.org/pipermail/numpy-discussion/attachments/20060128/836c8f6e/attachment.bin 

More information about the Numpy-discussion mailing list