If you find yourself generating long lists of indices into an array, there is a good chance that it can be solved in more elegant way using boolean matrices. In your case:
a = np.random.rand(5, 5)
a = a + a.T # make it symmetrical
sort_idx = np.argsort(np.argsort(a, axis=1), axis=1)
k = 3 # values to keep
# if you want a copy of the original
mask = (sort_idx >= a.shape[1] - k) # positions we want to keep
b = np.zeros_like(a)
b[mask] = a[mask]
# if you wantrd to do the operation in-place
# mask = (sort_idx < a.shape[1] - k) # positions we want to zero
# a[mask] = 0
>>> a
array([[ 1.87816548, 0.86562424, 1.94171234, 0.96565312, 0.53451029],
[ 0.86562424, 1.13762348, 1.48565754, 0.78031763, 0.51448499],
[ 1.94171234, 1.48565754, 1.39960519, 0.57456214, 1.32608456],
[ 0.96565312, 0.78031763, 0.57456214, 1.56469221, 0.74632264],
[ 0.53451029, 0.51448499, 1.32608456, 0.74632264, 0.55378676]])
>>> b
array([[ 1.87816548, 0. , 1.94171234, 0.96565312, 0. ],
[ 0.86562424, 1.13762348, 1.48565754, 0. , 0. ],
[ 1.94171234, 1.48565754, 1.39960519, 0. , 0. ],
[ 0.96565312, 0.78031763, 0. , 1.56469221, 0. ],
[ 0. , 0. , 1.32608456, 0.74632264, 0.55378676]])