December 2017
Intermediate to advanced
386 pages
10h 42m
English
An alternative to repeat() is the tile() function, which is used to copy a whole array into a tiled pattern. For example, let's try the following:
x = np.array([[1,2],[3,4]])y = np.tile(x,(2,3))
This will take the array x and repeat it twice along axis 0, and then repeat the resulting array three times along axis 1. The result is a 2 x 3 tiling of the input array, as shown in the following output:
array([[1, 2, 1, 2, 1, 2], [3, 4, 3, 4, 3, 4], [1, 2, 1, 2, 1, 2], [3, 4, 3, 4, 3, 4]])
Read now
Unlock full access