I would like to give an existing numpy array named columns. I've tried to name the columns in the following way:
X = np.random.normal(0,1,(3,3))
names = ['a','b','c']
types = ['f4']*len(names)
t = list(zip(names,types))
Y= np.array(X, dtype=t)
However, when I call Y['a'], I am given a 3x3 array rather than the first column of X, which is 3x1.
How can I give an existing array named columns? What is my error in my example?
np.random.normalprobably returnsf8X.tolist()is needed as an intermediate form. But it might also need to be converted to a list of tuples