yotama9 wrote: > Hello. > > I have several files of data that I want to merge into a single array > and then manipulate it (adding a single column to all the column > etc.) > > Each file is constructed of two columns. I want to take the columns of > the first file and add to the the second column of each file. > > Is there a way to do so?
Personally, I would use numpy and numpy.loadtxt for this sort of thing: sage: !cat file1 2 3 1 0 3 10 sage: !cat file2 23 29 20 21 3 -19 sage: import numpy sage: a=numpy.loadtxt('file1') sage: a array([[ 2., 3.], [ 1., 0.], [ 3., 10.]]) sage: b=numpy.loadtxt('file2') sage: b array([[ 23., 29.], [ 20., 21.], [ 3., -19.]]) sage: a+b array([[ 25., 32.], [ 21., 21.], [ 6., -9.]]) Jason -- Jason Grout --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---