reverse row order pandas

Solutions on MaxInterview for reverse row order pandas by the best coders in the world

showing results for - "reverse row order pandas"
Niko
17 Feb 2017
1import pandas as pd
2
3df = pd.DataFrame({'a':[1,2,3],
4                   'b':[4,5,6,],
5                   'c':[7,8,9,]})
6
7df_col_reversed = df.loc[:, ::-1] # reverse column order
8df_row_reversed = df.loc[::-1, :] # reverse row order