Exemple de fonction de répétition Python Numpy

# welcome to softhunt.net
# Python Program illustrating
# numpy.repeat()

import numpy as np

arr = np.arange(6).reshape(2, 3)
print("arr : \n", arr)

repetitions = 2
print("\nRepeating arr : \n", np.repeat(arr, repetitions, 1))
print("arr Shape : \n", np.repeat(arr, repetitions).shape)


repetitions = 2
print("\nRepeating arr : \n", np.repeat(arr, repetitions, 0))
print("arr Shape : \n", np.repeat(arr, repetitions).shape)
	
repetitions = 3
print("\nRepeating arr : \n", np.repeat(arr, repetitions, 1))
print("arr Shape : \n", np.repeat(arr, repetitions).shape)
Outrageous Ostrich