You can stack two arrays with numpy.lib.recfunctions
method and preserve the type with it:
>>> from numpy.lib.recfunctions import append_fields
>>> a = numpy.rec.array(a, dtype=[('a', numpy.float64)])
>>> new_a = append_fields(a, 'b', b, usemask=False, dtypes=[numpy.int64])
>>> new_a
array([(1.0, 1), (2.0, 2), (3.0, 3)],
dtype=[('a', '<f8'), ('b', '<i8')])
>>> new_a['a']
array([ 1., 2., 3.])
>>> new_a['b']
array([1, 2, 3])
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…