Python Numpy np.unique()方法
在np.unique()方法的帮助下,我们可以从np.unique()方法中作为参数给出的数组中获得唯一的值。
语法: np.unique(Array)
返回:返回一个数组的唯一性。
例子#1 :
在这个例子中,我们可以看到,通过使用np.unique()方法,我们能够从一个数组中获得唯一的值,通过使用这个方法。
输出 :
[1 2 3 4 6 8]
例子#2 :
输出 :
[1. 3.6 5. 10. 10.2 14.8 15. 21.4]