On Wed, Sep 16, 2009 at 5:10 AM, <[email protected]> wrote: > On Wed, Sep 16, 2009 at 4:42 AM, Pierre GM <[email protected]> wrote: >> >> On Sep 16, 2009, at 4:25 AM, [email protected] wrote: >> >>> I have two structured arrays of different types. How can I >>> horizontally concatenate the two arrays? Is there a direct way, or do >>> I need to start from scratch? >> >> Check numpy.lib.recfunctions, that should get you started. > > Thanks, I was doing that, but without reading through every option > of every function, they all seem to do something more > complicated, like merge or joinby, > append_fields doesn't look very convenient, adds one by one > > looking some more recursive_fill_fields seems also to do the > loop (but also handles nested structured arrays) > > tt = np.empty((10,1),dt2) > numpy.lib.recfunctions.recursive_fill_fields(testdata, tt) > numpy.lib.recfunctions.recursive_fill_fields(testdatacont, tt) > > So, I guess the answer is, loop over columns of structured arrays > > Josef >
I spent a lot of time trying to do this for categorical in statsmodels when we have to append the array of dummies to a mixed dtype structured array. recfunctions.append_fields was the best I could come up with. Skipper _______________________________________________ NumPy-Discussion mailing list [email protected] http://mail.scipy.org/mailman/listinfo/numpy-discussion
