Let's say I have an array like
0,1,0
0,1,0
0,1,0
Is there a way that I can get this array to be double the dimensions so that let's so the new array is like this:
0,0,1,1,0,0
0,0,1,1,0,0
0,0,1,1,0,0
0,0,1,1,0,0
0,0,1,1,0,0
0,0,1,1,0,0
numpy.repeat() should work here. I think you have to call it twice to get it to repeat in both axes.
a = np.array([[0,1,0],
[0,1,0],
[0,1,0]
])
a.repeat(2, axis=1).repeat(2, axis=0)
This gives you:
array([[0, 0, 1, 1, 0, 0],
[0, 0, 1, 1, 0, 0],
[0, 0, 1, 1, 0, 0],
[0, 0, 1, 1, 0, 0],
[0, 0, 1, 1, 0, 0],
[0, 0, 1, 1, 0, 0]])
[a, b, c]would become[a, a, b, b, c, c], and every column to then be duplicated as well?[a, b, c]and produce[a, b, c, a, b, c]