Edited since my last question was a duplicate, but I'm struggling with this as well. I'm currently working with a matrix and can easily find the largest element with
M[M != 1].max()
However, I'm interested in getting the N largest elements and can't find an easy way to do this with matrices. Is there an efficient solution?