Advertisement
Guest User

Untitled

a guest
Feb 24th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. import pandas as pd
  2.  
  3. df = pd.DataFrame()
  4. df[0] = pd.Series( [ 'a', 'aa', 'c' ] * 2 )
  5. df[1] = pd.Series( [ 1, 2 ] * 3 )
  6. df[2] = pd.Series( range(6) )
  7. print( df )
  8.  
  9. 0 1 2
  10. 0 a 1 0
  11. 1 aa 2 1
  12. 2 c 1 2
  13. 3 a 2 3
  14. 4 aa 1 4
  15. 5 c 2 5
  16.  
  17. order = [ 'a', 'c', 'aa' ]
  18.  
  19. print( sorted_df )
  20.  
  21. 0 1 2
  22. 0 a 1 0
  23. 1 a 2 3
  24. 2 c 1 2
  25. 3 c 2 5
  26. 4 aa 1 4
  27. 5 aa 2 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement