I am trying to learn how to use numpy's structured arrays. Specifically, I was trying to add information to more than one field at a time. I tried:
import numpy as np
numrec = np.zeros(8, dtype=[('col0', 'int16'), ('col1', 'int16'),
('col2', 'int16'), ('col3', 'int16')])
numrec[['col1','col2']][0:2] = [(3,5), (1,8)]
print numrec
The above does not work. The values are not added to the columns specified. What is surprising is that I do not get any error when I run it. Can someone please explain what is happening?
Thanks.