import pandas as pd
df = pd.DataFrame([1, 2, 3, 4, 5], index=[10, 52, 24, 158, 112], columns=['S'])
df.sort_index(inplace=True)
print df
pandas通过索引进行排序
最新推荐文章于 2024-04-22 20:29:04 发布
import pandas as pd
df = pd.DataFrame([1, 2, 3, 4, 5], index=[10, 52, 24, 158, 112], columns=['S'])
df.sort_index(inplace=True)
print df