Advertisement
Guest User

Untitled

a guest
Jan 29th, 2020
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. import csv
  2. import pandas as pd
  3.  
  4. #coronavirus [locatie, aantal slachtoffers, date, ebola]
  5.  
  6. with open("D:/hackaton_atonce/coronavirus.csv") as bestand:
  7. csv_reader = csv.reader(bestand, delimiter=',')
  8. first = 0
  9. arraydata = []
  10. for record in csv_reader:
  11. if first:
  12. if record[0] != "":
  13. locatie = record[1]+"_"+record[0]
  14. slachtoffers = record[6]
  15. datum = record[2]
  16. bestand.readline()
  17. arraydata.append([locatie, slachtoffers, datum, "coronavirus"])
  18. else:
  19. bestand.readline()
  20. else:
  21. first = 1
  22. df = pd.DataFrame(arraydata, columns=['locatie', 'totaal', 'datum', 'virus'], dtype=float)
  23. print(df)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement