for j, val in enumerate(non_zero_hits):
    index = np.where(val == all_hits)[0]
frequencies[index] = counts[j]
print(frequencies[idx])
Replacing NumPy array entries with their frequencies / values from dictionary