对于
reindex需要创建索引
sample列:
df=df.set_index(['sample']).reindex(["CO ref","CO tus","CO raai"]).reset_index()
或使用有序分类:
cats = ["CO ref","CO tus","CO raai"]df['sample'] = pd.CategoricalIndex(df['sample'], ordered=True, categories=cats)df = df.sort_values('sample')
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)