Answers for "ravel in python"

1

.ravel python

import numpy as np  
x = np.array([[1, 3, 5], [11, 35, 56]])  
y = np.ravel(x, order='F')  
z = np.ravel(x, order='C')  
p = np.ravel(x, order='A')  
q = np.ravel(x, order='K')  
y  
z  
p  
q  
#Output
array([ 1, 11,  3, 35,  5, 56])
array([ 1,  3,  5, 11, 35, 56])
array([ 1,  3,  5, 11, 35, 56])
array([ 1,  3,  5, 11, 35, 56])
Posted by: Guest on August-25-2021
1

ravel python

>>> x = np.array([[1, 2, 3], [4, 5, 6]])
>>> np.ravel(x)
array([1, 2, 3, 4, 5, 6])
Posted by: Guest on December-17-2020

Python Answers by Framework

Browse Popular Code Answers by Language