Lets start with two arrays:
>>> a
array([0, 1, 2, 3, 4])
>>> b
array([5, 6, 7])
Transposing either array does not work because it is only 1D- there is nothing to transpose, instead you need to add a new axis:
>>> b.T
array([5, 6, 7])
>>> b[:,None]
array([[5],
[6],
[7]])
To get the dot product to work as shown you would have to do something convoluted:
>>> np.dot(a[:,None],b[None,:])
array([[ 0, 0, 0],
[ 5, 6, 7],
[10, 12, 14],
[15, 18, 21],
[20, 24, 28]])
You can rely on broadcasting instead of dot
:
a[:,None]*b
Or you can simply use outer:
np.outer(a,b)
All three options return the same result.
You might also be interested in something like this so that each vector is always a 2D array:
np.dot(np.atleast_2d(a).T, np.atleast_2d(b))