[SciPy-User] reversing or avoiding the need to reverse argsort()
Sat Mar 20 10:37:21 CDT 2010
What I want to do is simple but not sure the best way to go about it.
I have an array a, shape(a) = rXc I need to sort each column
aargsort = a.argsort(axis=0) # May use this later
aSort = a.sort(axis=0)
now average each row
aSortRM = asort.mean(axis=1)
now replace each col in a row with the row mean.
is there a better way than this
aWithMeans = ones_like(a)
for ind in range(r) # r = number of rows
Now I need to undo the sort I did in the first step.
I think this is where I need the aargsort (argsort of a before any
modification) I am kinda stumped on this step. Everything I think of is
Is it possible to do this whole process without actually rearranging the
original array and just using the index info from the argsort() and would I
want to do this?
my blog <http://vincentdavis.net> |
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the SciPy-User