I have a array which must keep its dtype fixed. However, after a append statement, its dtype changes. How can I append values without changing the dtype?
vertices = array([0.5, 0.0, 0.0, 1.0, 0.0, 0.0,
0.0, 0.5, 0.0, 0.0, 1.0, 0.0,
0.0, -0.5, 0.0, 0.0, 0.5, 0.0], dtype=np.float32)
print(vertices.dtype)
vertices = append(vertices, [-0.5, 0.0, 0.0, 0.0, 0.0, 1.0])
print(vertices.dtype)
Output: float32 float64
np.appendis just a dumb front end tonp.concatenate. You don't need it (none of us do!). Just make sure all inputs have the desireddtype.