嵩天老师Python面向对象-56 Pandas库应用

import pandas as pd
import numpy as np
b = pd.DataFrame(np.arange(20).reshape(4,5),index=['c','a','d','b'])
print(b)
print(b.sort_index)
print(b.sort_index(ascending=False))
    0   1   2   3   4
c   0   1   2   3   4
a   5   6   7   8   9
d  10  11  12  13  14
b  15  16  17  18  19



    0   1   2   

你可能感兴趣的:(Python高级编程)