Guest User

Untitled

a guest
Jun 19th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. file_name = ["20180601.csv"]
  2.  
  3. raw_data = []
  4.  
  5. for f in file_name:
  6. fin = open(f, "r")
  7.  
  8. while True:
  9. line = fin.readline()[:-1]
  10. if not line: break
  11.  
  12. lines = line.split(',')
  13.  
  14. # userID / time / longitude / latitude / locationID
  15. user = lines[0]
  16.  
  17. # Get minute from times
  18. times = lines[1]
  19. minute = times.split(':')[1]
  20.  
  21. # Processing location to index
  22. longitude = lines[2]
  23. latitude = lines[3]
  24. location = lines[4]
  25.  
  26. raw_data.append((minute, (user, times, longitude, latitude, location)))
  27.  
  28. check = []
  29. for rd in raw_data:
  30. if rd[0] not in check:
  31. print(rd[1])
  32. check.append(rd[0])
Add Comment
Please, Sign In to add comment