Re: [Numpy-discussion] structured array from ordinary array

2009-12-13 Thread Pierre GM
On Dec 13, 2009, at 8:54 PM, Ernest Adrogué wrote: > Hi, > > How does one generate a structured array from a normal > array? > > I use the 'view' method, but this way I get a superfluous > dimension that I do not want. Example: > > In [619]: a = np.array([[1,2,3],[1,2,3],[1,2,4]],int) > > In [6

[Numpy-discussion] structured array from ordinary array

2009-12-13 Thread Ernest Adrogué
Hi, How does one generate a structured array from a normal array? I use the 'view' method, but this way I get a superfluous dimension that I do not want. Example: In [619]: a = np.array([[1,2,3],[1,2,3],[1,2,4]],int) In [620]: struct = np.dtype([('a',int),('b',int),('c',int)]) In [621]: a.view