Hackerss.com is a community of amazing hackers

Hackerss is a community for developers, data scientitst, ethical hackers, hardware enthusiasts or any person that want to learn / share their knowledge of any aspect of digital technology.

Create account Log in

Posted on

Python Remove duplicates of a numpy array

import numpy as np

def remove_duplicates(array):
    return np.unique(array)

print(remove_duplicates(np.array([1, 1, 2, 2, 3, 3, 4, 4, 5, 5])))
Enter fullscreen mode Exit fullscreen mode

Top comments (0)