I'm trying to create a float32 array as follows,
np.float32([kp2, kp2+dir_v*dist, kp2 + dir_v_r*dist])
However, I'm getting the following error,
ValueError: setting an array element with a sequence.
I tried to cast it to numpy array explicitly as follows and retry but still, I'm getting the same error
np.array([kp2, kp2+dir_v*dist, kp2 + dir_v_r*dist]).astype(float)
what am I missing?
Specify the datatype with the dtype
argument to np.array()
.
np.array([kp2, kp2+dir_v*dist, kp2 + dir_v_r*dist], dtype=float)