Python 数据处理之对 list 数据进行数据重排(为连续的数字序号)

Python 数据处理之对 list 数据进行数据重排(为连续的数字序号)

# user ID 序号重新排,即,原来是 1,3,4,6 ,排为 1,2,3,4

# item ID 序号重新排,too

使用 方法:

df3['userid_reset'] = df3['userid'].rank(ascending=1, method='dense')
df3['itemid_reset'] = df3['itemid'].rank(ascending=1, method='dense')

 

 

参数意义:

ascending=1是升序

descending=1 是降序

 

 (啊~链接找不到了~~~)

 

来了来了来了:

python pandas 组内排序、单组排序、标号的实例:http://www.cppcns.com/jiaoben/python/225206.html

 

posted on 2019-08-07 15:01  CuriousZero  阅读(2368)  评论(0编辑  收藏  举报

导航