
Hamid H. answered 04/01/20
PhD Candidate in Computer Sci. with 10+ Years of Experience in Coding
You can use numpy unique function, something like this:
import numpy as np
def get_max_dup(mylist):
_, counts = np.unique(mylist, return_counts=True)
max_dup = max(counts)
if max_dup == 1:
return -1
else:
return max_dup