cipy.org
> נושא: [Numpy-discussion] inserting indexes into an array
>
> 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
Possibilities:
column_stack((arange(len(ar)),ar))
or
transpose((arange(len(ar)),ar)).ravel()
Nadav.
-הודעה מקורית-
מאת: [EMAIL PROTECTED] בשם Thomas Heller
נשלח: ד 24-ספטמבר-08 11:30
אל: numpy-discussion@scipy.org
נושא: [Numpy-discussion] inserting indexes into an array
I have a
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])
-