The setdiff1d
function returns the unique values in array 1 that are not in array 2.
>>> import numpy as np
# Array 1
>>> a = np.array([4, 5, 6.2, 8, 10])
# Array 2
>>> b = np.array([4, 5, 6, 7, 8])
# Return unique values in `a` that are not in `b`
>>> np.setdiff1d(a, b)
array([6.2, 10])
Gavin Wiggins © 2024.
Made on a Mac with Genja. Hosted on GitHub Pages.