Я буду использовать меньший массив (8 x 5), чтобы мы могли легко просматривать возвращаемые значения.
import numpy as NP
# just create a smaller array to work with:
A = NP.random.randint(0, 10, 40).reshape(8, 5)
# split A in half, to separate x and y
p, q = NP.vsplit(A, 2)
# create a 'template' array of the correct dimension
xy = NP.zeros(2, 4, 5)
# now just map the x and y values onto the template
xy[0:,:] = p
xy[1:,:] = q
# the transformed matrix:
array([[[ 8., 5., 2., 5., 7.],
[ 2., 6., 0., 7., 2.],
[ 4., 4., 7., 5., 5.],
[ 8., 5., 2., 0., 5.]],
[[ 4., 8., 6., 9., 2.],
[ 2., 6., 5., 8., 1.],
[ 3., 2., 6., 2., 2.],
[ 1., 8., 0., 7., 3.]]])