Advertisement
Guest User

Untitled

a guest
Aug 21st, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. df1 = pd.read_csv(io.StringIO('''value1 value2 value3 ID text
  2. -0.1 0.35 -0.5 4 THIS
  3. -0.2 0.05 -0.7 3 IS
  4. 0.1 0.1 0.8 5 DRIVING'''), sep=' {2,}')
  5. __main__:4: ParserWarning: Falling back to the 'python' engine because the 'c' engine does not support regex separators (separators > 1 char and different from '\s+' are interpreted as regex); you can avoid this warning by specifying engine='python'.
  6.  
  7. df1
  8. Out[96]:
  9. value1 value2 value3 ID text
  10. 0 -0.1 0.35 -0.5 4 THIS
  11. 1 -0.2 0.05 -0.7 3 IS
  12. 2 0.1 0.10 0.8 5 DRIVING
  13.  
  14. df2 = pd.read_csv(io.StringIO('''value1 value2 value3 ID text
  15. -0.1 0.35 -0.5 4 ME
  16. -0.2 0.05 -0.7 3 NUTS'''), sep=' {2,}')
  17. __main__:3: ParserWarning: Falling back to the 'python' engine because the 'c' engine does not support regex separators (separators > 1 char and different from '\s+' are interpreted as regex); you can avoid this warning by specifying engine='python'.
  18.  
  19. df2
  20. Out[98]:
  21. value1 value2 value3 ID text
  22. 0 -0.1 0.35 -0.5 4 ME
  23. 1 -0.2 0.05 -0.7 3 NUTS
  24.  
  25. pd.concat([df1,df2], axis=0, ignore_index=True)
  26. Out[99]:
  27. value1 value2 value3 ID text
  28. 0 -0.1 0.35 -0.5 4 THIS
  29. 1 -0.2 0.05 -0.7 3 IS
  30. 2 0.1 0.10 0.8 5 DRIVING
  31. 3 -0.1 0.35 -0.5 4 ME
  32. 4 -0.2 0.05 -0.7 3 NUTS
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement