[SciPy-User] Combining arrays based on (x,y) index values

Vincent Davis vincent@vincentdavis....
Sat Mar 6 15:46:25 CST 2010


I have 3 arrays, each have an x and y column and I need to extend each row
with the additional rows from the other arrays. Only one of the arrays has
all the x,y values. I am also not sure how to deal with the missing values.
I was thinking about making an array full of nan. So for example if I have
>>> bb
array([['1', '1', 'apple', 'pie'],
       ['2', '5', 'boys', 'play']],
      dtype='|S8')
>>> aa
array([[1, 1,free],
       [1, 2,upgrade],
       [1, 3, down],
       [2, 4, left],
       [2, 5, right],
       [2, 6, now]])
and I what to end up with

magicfunc(aa,bb)
array([[1, 1, free,  'apple', 'pie'],
       [1, 2, upgrade, '', ''],
       [1, 3, down,  '', ''],
       [2, 4, left, '', ''],
       [2, 5, right, 'boys', 'play'],
       [2, 6, now, '', '']])

Whats the "right" way to do this, I have several ideas but I can't be the
first to do this. I know the dimensions of the final array. but don't really
have a plan of where to go from there.

  *Vincent Davis
720-301-3003 *
vincent@vincentdavis.net
 my blog <http://vincentdavis.net> |
LinkedIn<http://www.linkedin.com/in/vincentdavis>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20100306/0e348ca0/attachment.html 


More information about the SciPy-User mailing list