This answer https://stackoverflow.com/a/1582742/13326667 has details on cloning row using numpy.tile.
>>> tile(array([1,2,3]), (3, 1))
array([[1, 2, 3],
[1, 2, 3],
[1, 2, 3]])
What is the purpose of (3,1) here? Can someone explain what the 3 means and the 1 means?
CodePudding user response:
3 is the number of times he have to clone it horizontally
and 1 is the number of times he have to clone it vertically:
for example if you have:
import numpy as np
tile = np.tile(
np.array([
[1,2,3], #<- row 1 here
[1,2,3] #<- row 2 here
]),(2,2)
)
print(tile)
you would get the array, cloned 2 times vertically and 2 times horizontally:
[[1 2 3 1 2 3]
[1 2 3 1 2 3]
[1 2 3 1 2 3]
[1 2 3 1 2 3]]
