我有 df 看起来像这样:
Label Base
Label
Très à gauche 4.51
Très à droite 10.49
Ni à gauche, ni à droite 24.21
Je ne sais pas 5.60
Au centre 8.69
A gauche 23.74
A droite 22.75
Run Code Online (Sandbox Code Playgroud)
我想按升序排序,但我不希望排序中包含“A gauche”和“A droite”。
下面的代码做了我想要的,但我不确定如何从排序中排除“A gauche”和“A droite”。
df_table = df_table.sort(columns="Base",ascending=True)
Run Code Online (Sandbox Code Playgroud)
预期产出
Label Base
Label
Très à gauche 4.51
Je ne sais pas 5.60
Au centre 8.69
Très à droite 10.49
Ni à gauche, ni à droite 24.21
A gauche 23.74
A droite 22.75
Run Code Online (Sandbox Code Playgroud)
谢谢