Advertisement
Guest User

Untitled

a guest
Mar 29th, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. f1_col1 f1_col2 f2_col1 f2_col2 ... ...
  2. 0 2.1 0 3.0 ... ...
  3. 1 4.6 1 4.5 ... ...
  4. 2 0.6 2 9.4 ... ...
  5. 3 5.8 ... ...
  6. 4 4.6 ... ...
  7.  
  8. def group_for_display(files_list):
  9.  
  10. n = len(files_list)
  11. X = np.empty(shape=[0, n])
  12.  
  13. # loop through all files in the list
  14. for file_name in files_list:
  15. # open the file
  16. with open(file_name) as f:
  17. # skip first line
  18. next(f)
  19. # loop through all lines in the file
  20. for line in f:
  21. # split the line into columns
  22. temp, intens, dummy = line.split(",")
  23. temp = round(float((temp)))
  24. intens = float(intens)
  25. X = np.append(X, [[temp, intens]], axis=0)
  26.  
  27. return X
  28.  
  29. f1_col1 f1_col2
  30. 0 2.1
  31. 1 4.6
  32. 2 0.6
  33. 0 3.0
  34. 1 4.5
  35. 2 9.4
  36. 3 5.8
  37. 4 4.6
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement