Index=new_vals[1].argmax

why have we used 1 in the argument?
also what does unique do?

np.unique(arr, return_counts=True)

Returns a tuple whose first element is a numpy array that has all the unique elements in arr and second element is a numpy array that has the count of all the elements of the first array in arr.
eg.

arr = [2, 3, 5, 2, 1, 0, 7, 8, 5, 5, 3, 1]
res = np.unique(arr, return_counts=True)) 
print(res)#prints (array([0, 1, 2, 3, 5, 7, 8]), array([1, 2, 2, 2, 3, 1, 1]))

Here as you can see, res[0] contains the unique elements of arr and res[1] contains their count in arr, i.e, 0 1 times, 1 2 times, 2 2 times, 3 2 times, 5 3 times, 7 1 times and 8 1 times.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.