Advertisement
Guest User

Untitled

a guest
Jan 18th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.73 KB | None | 0 0
  1. >>> stubnames = ['group1', 'group2']
  2. >>> i = 'Test'
  3. >>> j = 'a-b-Label'
  4. >>> suffix = '.+'
  5. >>> sep = '_'
  6. >>>
  7. >>> stackme
  8. group1_a1 group1_b2 Test group2_a1 group2_b2
  9. 0 0.45 0.3 Test1 2 6
  10. 1 0.03 1.2 Test2 9 7
  11. 2 0.70 4.2 Test3 4 2
  12. >>>
  13. >>> pd.wide_to_long(stackme, stubnames=stubnames, i=i, j=j, sep='_', suffix=suffix)
  14. group1 group2
  15. Test a-b-Label
  16. Test1 a1 0.45 2
  17. Test2 a1 0.03 9
  18. Test3 a1 0.70 4
  19. Test1 b2 0.30 6
  20. Test2 b2 1.20 7
  21. Test3 b2 4.20 2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement