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

0

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]
Posted by: Guest on June-07-2020
0

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

set(array.flat)
Posted by: Guest on June-07-2020
0

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])
Posted by: Guest on June-07-2020
0

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

list(set(array.flat))
Posted by: Guest on June-07-2020

Code answers related to "how to convert array of arrays into single array with unique values in numpy"

Python Answers by Framework

Browse Popular Code Answers by Language