[Numpy-discussion] inserting indexes into an array

Thomas Heller theller@ctypes....
Wed Sep 24 03:30:24 CDT 2008

I have a numpy array comtaining numbers (a, b, ...), like this:

array([a, b, c, d, e, f])

What is the fastest way to create another array that has the index
of the element before each element of the original array?

The result should look like this:

array([0, a, 1, b, 2, c, 3, d, 4, e, 5, f])


More information about the Numpy-discussion mailing list