Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pandas as pd
- df = pd.DataFrame()
- df[0] = pd.Series( [ 'a', 'aa', 'c' ] * 2 )
- df[1] = pd.Series( [ 1, 2 ] * 3 )
- df[2] = pd.Series( range(6) )
- print( df )
- 0 1 2
- 0 a 1 0
- 1 aa 2 1
- 2 c 1 2
- 3 a 2 3
- 4 aa 1 4
- 5 c 2 5
- order = [ 'a', 'c', 'aa' ]
- print( sorted_df )
- 0 1 2
- 0 a 1 0
- 1 a 2 3
- 2 c 1 2
- 3 c 2 5
- 4 aa 1 4
- 5 aa 2 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement