Hi list,
maybe this is a really stupid idea, and I don't want to advertise this, but
what actually happens when I reassign the dtype of an object?
Does it return the same as array.view?
say I have the following code
In [64]: b
Out[64]:
array([[ 0, 1, 2],
[ 3, 4, 5],
[ 6, 7, 8],
[ 9, 10, 11],
[12, 13, 14]])
<snip />
In [69]: t = N.dtype(zip(('a', 'b', 'c'), (N.int32, N.int32, N.int32)))
In [70]: b.view(t)
Out[70]:
array([[(0, 1, 2)],
[(3, 4, 5)],
[(6, 7, 8)],
[(9, 10, 11)],
[(12, 13, 14)]],
dtype=[('a', '
Jan Strube wrote:
Hi list, maybe this is a really stupid idea, and I don't want to advertise this, but what actually happens when I reassign the dtype of an object? Does it return the same as array.view?
Yes, it is the same. In fact, IIRC it uses very similar code. -Travis
participants (2)
-
Jan Strube
-
Travis Oliphant