How do I turn the array a = [[[[1, 2, 3, 4], [5, 6, 7, 8]], [[9, 10, 11, 12], [13, 14, 15, 16]]]] into a numpy matrix of the form
[[1,2,3,4],
[5,6,7,8],
[9,10,11,12],
[13,14,15,16]]
? I have tried np.bmat(a) to no avail. When I do that, I get a 2×6 matrix.
Use
np.arrayto construct the array, thenreshapeto mold it into the right shape: