Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Python NumPy repeat Function Example

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

import numpy as np

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

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


repetitions = 2
print("
Repeating arr : 
", np.repeat(arr, repetitions, 0))
print("arr Shape : 
", np.repeat(arr, repetitions).shape)
	
repetitions = 3
print("
Repeating arr : 
", np.repeat(arr, repetitions, 1))
print("arr Shape : 
", np.repeat(arr, repetitions).shape)
Source by softhunt.net #
 
PREVIOUS NEXT
Tagged: #Python #NumPy #repeat #Function #Example
ADD COMMENT
Topic
Name
5+1 =