convert to a numpy array before indexing instead