ENH: Speed-up small code snippet:

Using numpy better, let's speed up by a lot!

In [5]: %timeit old()
10000 loops, best of 3: 116 µs per loop

In [6]: %timeit new()
100000 loops, best of 3: 4.47 µs per loop

Thanks @adamrp