Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- filenames = ["foo", "bar"]
- col1_all = 0 #data will be stored in these 3 arrays
- col2_all = 0
- col3_all = 0
- for f in filename:
- col1, col2, col3 = np.loadtxt(f, unpack=True)
- if col1.shape[0] > 0: # I can't guarantee file won't be empty
- if type(col1_all) == int:
- # if there is no data read in yet, just copy arrays
- col1_all = col1[:]
- col2_all = col2[:]
- col3_all = col3[:]
- else:
- col1_all = np.concatenate((col1_all, col1))
- col2_all = np.concatenate((col2_all, col2))
- col3_all = np.concatenate((col3_all, col3))
Add Comment
Please, Sign In to add comment