Python 數據處理之對 list 數據進行數據重排(爲連續的數字序號)html
# user ID 序號從新排,即,原來是 1,3,4,6 ,排爲 1,2,3,4python
# item ID 序號從新排,toospa
使用 方法:code
df3['userid_reset'] = df3['userid'].rank(ascending=1, method='dense') df3['itemid_reset'] = df3['itemid'].rank(ascending=1, method='dense')
參數意義:htm
ascending=1是升序blog
descending=1 是降序排序
(啊~連接找不到了~~~)get
來了來了來了:pandas
python pandas 組內排序、單組排序、標號的實例:http://www.cppcns.com/jiaoben/python/225206.htmlit