[Numpy-discussion] dtyping with .astype()

2011-10-17 Thread Alex van der Spek
Beginner's question? I have this dictionary dtypes of names and types: dtypes {'names': ['col1', 'col2', 'col3', 'col4', 'col5'], 'formats': [type 'numpy.float16', type 'numpy.float16', type 'numpy.float16', type 'numpy.float16', type 'numpy.float16']} and this array y y array([[ 0, 1, 2,

Re: [Numpy-discussion] dtyping with .astype()

2011-10-17 Thread Pauli Virtanen
13.10.2011 12:59, Alex van der Spek kirjoitti: gives me a confusing result. I only asked to name the columns and change their types to half precision floats. Structured arrays shouldn't be thought as an array with named columns, as they are somewhat different. What am I missing? How to do

Re: [Numpy-discussion] dtyping with .astype()

2011-10-17 Thread josef . pktd
On Mon, Oct 17, 2011 at 6:17 AM, Pauli Virtanen p...@iki.fi wrote: 13.10.2011 12:59, Alex van der Spek kirjoitti: gives me a confusing result. I only asked to name the columns and change their types to half precision floats. Structured arrays shouldn't be thought as an array with named

Re: [Numpy-discussion] dtyping with .astype()

2011-10-17 Thread Pauli Virtanen
17.10.2011 15:48, josef.p...@gmail.com kirjoitti: On Mon, Oct 17, 2011 at 6:17 AM, Pauli Virtanen p...@iki.fi wrote: [clip] What am I missing? How to do this? np.rec.fromarrays(arr.T, dtype=dt) y.astype(float16).view(dt) I think this will give surprises if the original array is not in

Re: [Numpy-discussion] dtyping with .astype()

2011-10-17 Thread josef . pktd
On Mon, Oct 17, 2011 at 10:18 AM, Pauli Virtanen p...@iki.fi wrote: 17.10.2011 15:48, josef.p...@gmail.com kirjoitti: On Mon, Oct 17, 2011 at 6:17 AM, Pauli Virtanen p...@iki.fi wrote: [clip] What am I missing? How to do this? np.rec.fromarrays(arr.T, dtype=dt) y.astype(float16).view(dt)