If I define a structured array:
import numpy as np
x = np.array([(1, 'O', 1)],
dtype=np.dtype([('step', 'int32'),
('symbol', '|S1'),
('index', 'int32')]))
seems fine until I do this:
import numpy.lib.recfunctions as rec
rec.append_fields(x,'x',x['index']+1)
gives me
TypeError: object of type 'numpy.int32' has no len()
presumably because x.shape is (1,) rather than (1,3). How do I append columns to this structured array?