Re: [Numpy-discussion] Picking rows with the first (or last) occurrence of each key

2016-07-02 Thread Juan Nunez-Iglesias
Hey Skip, Any way that you can make your keys numeric? Then you can run np.diff on that first column, and use the indices of nonzero entries (np.flatnonzero) to know where values change. With a +1/-1 offset (that I am too lazy to figure out right now ;) you can then index into the original rows to

[Numpy-discussion] Picking rows with the first (or last) occurrence of each key

2016-07-02 Thread Skip Montanaro
(I'm probably going to botch the description...) Suppose I have a 2D array of Python objects, the first n elements of each row form a key, the rest of the elements form the value. Each key can (and generally does) occur multiple times. I'd like to generate a new array consisting of just the first

[Numpy-discussion] AUTO: Leon Woo is out of the office (returning 11/07/2016)

2016-07-02 Thread Leon Woo
I am out of the office until 11/07/2016. For standard requests within the scope of EMG PWM Berlin, please write to EMG PWM Berlin@DBEMEA. For non-standard requests, please cc Hien Pham-Thu. Note: This is an automated response to your message "NumPy-Discussion Digest, Vol 118, Issue 2" sent on