I can reproduce your error with this:
u = np.array([[1,2], [2, 3, 4]])
u.astype(float)

it looks you are creating an array of vectors with different sizes. So your objects (‘o’) you are trying to convert into float are probably python sequences.