[Numpy-discussion] Error creating an array

Travis E. Oliphant oliphant@enthought....
Tue Aug 5 14:35:28 CDT 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