[Numpy-discussion] Error creating an array

Travis E. Oliphant oliphant at enthought.com
Tue Aug 5 15:35:28 EDT 2008


Sameer DCosta wrote:
> Im having a little trouble creating a numpy array with a specific
> dtype. I can create the array b with dtype=int, but not with the dtype
> I want. Any idea what I am doing wrong here?
>   
You must uses tuples for the individual "records" when constructing 
arrays with the "array" command.

Thus,

data = [(1,2), (3,4), (5,6)]

will work.

-Travis




More information about the NumPy-Discussion mailing list