Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

ravel python

>>> x = np.array([[1, 2, 3], [4, 5, 6]])
>>> np.ravel(x)
array([1, 2, 3, 4, 5, 6])
Comment

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]
Comment

PREVIOUS NEXT
Code Example
Python :: basic games to code in python 
Python :: print list in python 
Python :: pandas sort dataframe by column 
Python :: python flatten list 
Python :: python move a file from one folder to another 
Python :: pandas map using two columns 
Python :: send message from server to client python 
Python :: feature importance naive bayes python 
Python :: python acf and pacf code 
Python :: get page title by python bs4 
Python :: sum all values in a matrix python 
Python :: reshape wide to long in pandas 
Python :: generate binay image python 
Python :: kivy change window size 
Python :: python map string to int 
Python :: python string vs byte string 
Python :: how yo import python lib 
Python :: how to read multiple csv file from different directory in python 
Python :: swagger library for django 
Python :: simple graph in matplotlib categorical variables 
Python :: python if any element in string 
Python :: alpha beta pruning python code 
Python :: django regexvalidator example 
Python :: how to write and read dictionary to a file in python 
Python :: flask debugtoolbar 
Python :: how to run a python script 
Python :: matplotlib show plot 
Python :: asymmetric encryption python 
Python :: isdigit python 
Python :: Remove empty strings from the list of strings 
ADD CONTENT
Topic
Content
Source link
Name
7+5 =