R';python中的s阶等价

R';python中的s阶等价,python,r,python-2.7,Python,R,Python 2.7,你知道python对R的顺序的等价物是什么吗 order(c(10,2,-1, 20), decreasing = F) # 3 2 1 4 是的 如果您想探索递减=T选项。你可以试试 (-a).argsort() #array([3, 0, 1, 2]) 在numpy中有一个名为argsort import numpy as np lst = [10,2,-1,20] np.argsort(lst) # array([2, 1, 0, 3]) 请注意,在R中,python列表索引从

你知道python对R的
顺序的等价物是什么吗

order(c(10,2,-1, 20), decreasing = F) 
# 3 2 1 4
是的

如果您想探索
递减=T
选项。你可以试试

(-a).argsort()

#array([3, 0, 1, 2])

在numpy中有一个名为
argsort

import numpy as np
lst = [10,2,-1,20]
np.argsort(lst)
# array([2, 1, 0, 3]) 
请注意,在R中,python列表索引从0开始,而从1开始

import numpy as np
lst = [10,2,-1,20]
np.argsort(lst)
# array([2, 1, 0, 3])