Numpy Array Indexing With Sql Function