python开发之Pandas

 

正确的对DataFrame reverse运算

data.reindex(index=data.index[::-1])
or simply:
data.iloc[::-1]

will reverse your data frame, if you want to have a for loop which goes from down to up you may do:

for idx in reversed(data.index):
    print(idx, data.loc[idx, 'Even'], data.loc[idx, 'Odd'])
or
for idx in reversed(data.index):
    print(idx, data.Even[idx], data.Odd[idx])

 

posted @ 2017-01-18 10:41  老金280  阅读(168)  评论(0编辑  收藏  举报