Numpy
Numpy (10)
Jun's N
2022. 7. 30. 19:58
How to generate custom sequences in numpy without hardcoding?
a = np.array([1,2,3])
np.r_[np.repeat(a, 3), np.tile(a, 3)]
# output
array([1, 1, 1, 2, 2, 2, 3, 3, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3])
728x90