Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python ravel function

# numpy.ravel() method
# array.ravel is equivalent to reshape(-1, order=order)
import numpy as np
 
array = np.arrange(15).reshape(3, 5)
print("Original array : 
", array)

print("
ravel() : ", array.ravel())

print("Reshaping array : ", array.reshape(-1))


# Output:
Original array : 
 [[ 0  1  2  3  4]
 [ 5  6  7  8  9]
 [10 11 12 13 14]]
ravel() :  [ 0  1  2 ..., 12 13 14]
Reshaping array : [ 0  1  2 ..., 12 13 14]
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #python #ravel #function
ADD COMMENT
Topic
Name
5+4 =