On a particular large dataset this solution was the fastest I could come up with for standard CPython.