sort_values()函数

1 可用于对dateframe的多列同时进行排序

True是升序,False是降序

kk.sort_values(by=['listing_id','order_id'], ascending=[True, True])
#           user_id  listing_id  order_id
# 193           203       17298         9
# 190           203       17298        10
# 191           203       17298        11
# 192           203       17298        12
# 6303049       203       98510         6
# 6303048       203       98510         7
# 6303047       203       98510         8
# 6303046       203       98510         9
# 8383891       203      134495         5
# 8383893       203      134495         6
# 8383886       203      134495         7
# 8383887       203      134495         8
# 8383888       203      134495         9
# 8383889       203      134495        10
# 8383890       203      134495        11
# 8383892       203      134495        12

https://blog.csdn.net/m0_37637511/article/details/79901071

猜你喜欢

转载自www.cnblogs.com/xxswkl/p/10986968.html