I have two numpy.ndarrays
which one is a random sample from the other. I wish to take the smaller one (random sample) and remove those data points from the larger one.
What is the code to do so?
Thank you
Maybe this can help:
a = np.array([1, 2, 3, 2, 4, 1])
b = np.array([3, 4, 5, 6])
np.setdiff1d(a, b) # array([1, 2])
From here .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.