[Numpy-discussion] Named dtype array: Difference between a[0]['name'] and a['name'][0]?
bmu
diehose at freenet.de
Sun May 20 07:45:03 EDT 2012
I came acroos a question on stackoverflow (http://stackoverflow.com/q/9470604)
and I am wondering if this is a bug
import numpy as np
dt = np.dtype([('tuple', (int, 2))])
a = np.zeros(3, dt)
type(a['tuple'][0]) # ndarray
type(a[0]['tuple']) # ndarray
a['tuple'][0] = (1,2) # ok
a[0]['tuple'] = (1,2) # ValueError: shape-mismatch on array construction
Could somebody explain this behaviour (either in this mailing list or on
stackoverflow)?
bmu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20120520/c582b8f2/attachment.html>
More information about the NumPy-Discussion
mailing list