Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to convert array of arrays into single array with unique values in numpy

set(array.flat)
Comment

how to convert array of arrays into single array with unique values in numpy

list(set(array.flat))
Comment

how to convert array of arrays into single array with unique values in numpy

>>> array = np.zeros((10,12,42,53))
>>> list(set(array.flat))
[0.0]
Comment

how to convert array of arrays into single array with unique values in numpy

>>> array = np.zeros((10,12),dtype=int)
>>> print array
[[0 0 0 0 0 0 0 0 0 0 0 0]
 [0 0 0 0 0 0 0 0 0 0 0 0]
 [0 0 0 0 0 0 0 0 0 0 0 0]
 [0 0 0 0 0 0 0 0 0 0 0 0]
 [0 0 0 0 0 0 0 0 0 0 0 0]
 [0 0 0 0 0 0 0 0 0 0 0 0]
 [0 0 0 0 0 0 0 0 0 0 0 0]
 [0 0 0 0 0 0 0 0 0 0 0 0]
 [0 0 0 0 0 0 0 0 0 0 0 0]
 [0 0 0 0 0 0 0 0 0 0 0 0]]
>>> np.unique(array)
array([0])
>>> array[0,5] = 1
>>> array[4,10] = 42
>>> np.unique(array)
array([ 0,  1, 42])
Comment

PREVIOUS NEXT
Code Example
Python :: python integrated with activeX 
Python :: form a chakravyuh matrix python 
Python :: Image loader RGB transform 
Python :: pyjone location 
Python :: python web app with redis github 
Python :: python ocr pdf dataframe 
Python :: convert month weeks days into month days in python pandas 
Python :: selecting letters in a row 
Python :: dask dataframe csv tutorial 
Python :: np.argmax python could not be evaluated 
Python :: hello world in dip 
Python :: how to predict the output for new data with the model tested already 
Python :: the process of delivery of any desisered data 
Python :: how to format a matrix to align all rows python 
Python :: what is comma in regex 
Python :: dfs and bfs in python 
Python :: fibonacci sequence python genorator 
Python :: dynamo python template path 
Python :: Modifiying line plots 
Python :: Convert a list of dictionary into a feature vector 
Python :: json timestamp to date python 
Python :: what is te meaning of nested in python 
Python :: pdb step into 
Python :: check string in a list for substrings and return index 
Python :: bson to dataframe pandas 
Python :: python concat list multiple times 
Python :: # difference between list 1 and list 2 
Python :: colorutils python 
Python :: print numbers 1 to 10 using recursion in python 
Python :: Simple Python Permutation Without Passing any argument 
ADD CONTENT
Topic
Content
Source link
Name
8+5 =