sort_index() 为什么会变成这样
行标签为什么变成了这样 本帖最后由 ouyunfu 于 2020-3-21 18:48 编辑
因为它是以字母表的顺序排序的 (f)our, (o)ne, (t)hree, (t)wo,第3,4个单词第一个字母一样,根据第二个字母排h , w
你也可以将加一个ascending=False,使排序颠倒过来,详情如下import numpy as np
import pandas as pd
a=np.array([['one','two','three','four'],,['a','b','c','d']])
b=pd.Series(a,index=a)
c=b.sort_index(ascending=False) ouyunfu 发表于 2020-3-21 18:38
因为它是以字母表的顺序排序的 (f)our, (o)ne, (t)hree, (t)wo,第3,4个单词第一个字母一样,根据第二个 ...
谢谢,原来如此
页:
[1]