Pandas - sortlevel()似乎不是词典

时间:2016-11-03 22:12:26

标签: python sorting pandas

我正在尝试按索引级别对多索引(索引和列)数据框进行排序,并获得意外结果。这是sortlevel调用之前的数据框:

Dataframe prior to sortlevel

enter image description here

然后我按如下方式调用sortlevel:

test.sortlevel(level='Bins',inplace=True,ascending=False)

返回以下数据帧:

Dataframe after sortlevel

enter image description here 我希望订单是优秀的,良好的,平庸的,非竞争性的,分数。通过以下方式检查指数水平:

print test.index.levels

返回以下列表:

[[...,u'fch_rf_5_off',...],[u'Non Competitive', u'Mediocre', u'Good', u'Excellent', u'Score']]

此列表在“得分”之前不会显示任何字符。这可能会导致这一点。我对这些想法感到茫然,并提供任何帮助!

0 个答案:

没有答案