Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Python NumPy ravel function example array.ravel is equivalent to reshape(-1, order=order)

# Python Program illustrating
# numpy.ravel() method

import numpy as np

array = np.arange(15).reshape(5, 3)
print("Original array : 
", array)

# Output comes like [ 0 1 2 ..., 12 13 14]
# as it is a long output, so it is the way of
# showing output in Python
print("
ravel() : ", array.ravel())

# This shows array.ravel is equivalent to reshape(-1, order=order).
print("
numpy.ravel() == numpy.reshape(-1)")
print("Reshaping array : ", array.reshape(-1))
Source by softhunt.net #
 
PREVIOUS NEXT
Tagged: #Python #NumPy #ravel #function #equivalent
ADD COMMENT
Topic
Name
2+9 =