我认为您需要
sort_index,因为调用了左列
index。完整命令为
mt =mobile.PattLen.value_counts().sort_index()。例如:
mobile = pd.Dataframe({'PattLen':[1,1,2,6,6,7,7,7,7,8]})print (mobile) PattLen0 11 12 23 64 65 76 77 78 79 8print (mobile.PattLen.value_counts())7 46 21 28 12 1Name: PattLen, dtype: int64mt = mobile.PattLen.value_counts().sort_index()print (mt)1 22 16 27 48 1Name: PattLen, dtype: int64


