[Numpy-discussion] help me

Miguel de Val-Borro miguel.deval@gmail....
Fri Mar 25 07:02:32 CDT 2011


On Fri, Mar 25, 2011 at 05:28:50PM +0530, dileep kunjaai wrote:
> Dear sir,
>  I have a numpy array,,. in which i have to choose only different values
> only,
> For example
> 
>     Let A= [ 20.  21.  22.  23.  24.  25.  20.  21.  22.  23.  24.  25.
> 20.  21.  22. 23.  24.  25.  20.  21.  22.  23.  24.  25.  20.  21.  22.
> 23.  24.  25.]
>  then
>  the answer is [20, 21.  22.  23.  24.  25.] ie choose only different values

Try the numpy.unique function:

>>> numpy.unique(A)
array([20, 21.  22.  23.  24.  25.])

Miguel


More information about the NumPy-Discussion mailing list