argsort in Python
def argsort(mylist):
return sorted(range(len(mylist)), key=mylist.__getitem__)
or
return [i for (v, i) in sorted((v, i) for (i, v) in enumerate(seq))]
posted on 2011-12-09 21:11 xueliangliu 阅读(435) 评论(0) 编辑 收藏 举报
def argsort(mylist):
return sorted(range(len(mylist)), key=mylist.__getitem__)
return [i for (v, i) in sorted((v, i) for (i, v) in enumerate(seq))]
posted on 2011-12-09 21:11 xueliangliu 阅读(435) 评论(0) 编辑 收藏 举报