I want to have a numpy array with values and corresponding labels for each value. I use this array for linear regression, and it will be my data vector Xin the equation y = Xb + error.
My Xvector consists of about 20 variables, each of which I would like to be able to refer by name like that X['variable1']. At first I used a dictionary for this, but realized that the scikit library for linear regression requires a numpy matrix, so I'm trying to create a numpy array that is marked as.
I get an error message:
TypeError: a bytes-like object is required, not 'int'.
This is what I do:
X = np.array([3],dtype=[('label1','int')])
In the end, I want to have 20 marked values, something like this:
X = np.array([3,40,7,2,...],
dtype=[('label1',int'),('label2','int'),('label3','int')...])
Truly appreciate any syntax help here. Thanks!