[Numpy-discussion] array with object

Torgil Svensson torgil.svensson at gmail.com
Wed Nov 29 15:11:35 CST 2006


It works if you replace the strings '2','3','5','6' with numbers instead.

This case got a better error-message:

>>> array(['2'],dtype=float32)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: a float is required

//Torgil


On 11/29/06, Lionel Roubeyrie <lroubeyrie at limair.asso.fr> wrote:
> Hi all,
> I don't understand why can't I do that:
> b=array([(datetime.datetime(2006,11,29),'2','3'),
> (datetime.datetime(2006,11,30),'5','6')], dtype=[('Dates', 'object'),
> ('HUM', 'float32'), ('TEM', 'float32')])
> ValueError: tried to set void-array with object members using buffer.
> Thanks
>
> --
> Lionel Roubeyrie - lroubeyrie at limair.asso.fr
> LIMAIR
> http://www.limair.asso.fr
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>


More information about the Numpy-discussion mailing list