[Numpy-discussion] stumped numpy user seeks help

Mathew Yeates myeates at jpl.nasa.gov
Tue Aug 29 17:46:45 CDT 2006


My head is about to explode.

I have an M by N array of floats. Associated with the columns are 
character labels
['a','b','b','c','d','e','e','e']  note: already sorted so duplicates 
are contiguous

I want to replace the 2 'b' columns with the sum of the 2 columns. 
Similarly, replace the 3 'e' columns with the sum of the 3 'e' columns.

The resulting array still has M rows but less than N columns. Anyone? 
Could be any harder than Sudoku.

Mathew





More information about the Numpy-discussion mailing list