I would simply like to create a numpy array of size(N,m) that has just the first column made of integer, and the rest by default float.
So that, if initialized to zero it should be results:
array([[ 0, 0., 0., 0., 0.],
[ 0, 0., 0., 0., 0.],
[ 0, 0., 0., 0., 0.],
[ 0, 0., 0., 0., 0.],
[ 0, 0., 0., 0., 0.]])
All the attempts I have made return me some tuple sub-elements when trying to create such a structured array.
You could use an array with
dtype = object:Notice that you get the right behavior when doing arithmetic.
Or you could use a
numpy.recarray:If you need to do arithmetic on all the values, you’ll have to perform the operation on each field seperately, e.g.