Is there an easy way to merge two numpy arrays with different rank sizes (terminology?). I want to make a single array by concatenating two arrays along a given direction and filling the excess cells with a dummy variable. numpy concatenate works well as long as the two arrays have the same dimension, but I want to do this on two array with a matching dimension size. An example:
import numpy as np a = np.array([[1,2,3],[4,5,6]]) b = np.array([[1,2],[3,4],[5,6]]) np.concatenate((a,a),axis=1) #This works fine, but isn't what I need. Out: array([[1, 2, 3, 1, 2, 3], [4, 5, 6, 4, 5, 6]]) np.concatenate((a,b),axis=1) #This doesn't work, but this is what I need. I want to fill the third row of array "a" with a dummy variable (99999 or NaN) and concatenate with "b" to make: [1,2,3,1,2] [4,5,6,4,5] [99999,99999,99999,5,6] This just seems like it would be relatively common. So I thought I'd check if I'm missing something before I go write the logic. Thanks! -- http://mail.python.org/mailman/listinfo/python-list