Guest User

Untitled

a guest
Apr 21st, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. import numpy as np
  2. filenames = ["foo", "bar"]
  3. col1_all = 0 #data will be stored in these 3 arrays
  4. col2_all = 0
  5. col3_all = 0
  6. for f in filename:
  7. col1, col2, col3 = np.loadtxt(f, unpack=True)
  8. if col1.shape[0] > 0: # I can't guarantee file won't be empty
  9. if type(col1_all) == int:
  10. # if there is no data read in yet, just copy arrays
  11. col1_all = col1[:]
  12. col2_all = col2[:]
  13. col3_all = col3[:]
  14. else:
  15. col1_all = np.concatenate((col1_all, col1))
  16. col2_all = np.concatenate((col2_all, col2))
  17. col3_all = np.concatenate((col3_all, col3))
Add Comment
Please, Sign In to add comment