Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import csv
- import pandas as pd
- #coronavirus [locatie, aantal slachtoffers, date, ebola]
- with open("D:/hackaton_atonce/coronavirus.csv") as bestand:
- csv_reader = csv.reader(bestand, delimiter=',')
- first = 0
- arraydata = []
- for record in csv_reader:
- if first:
- if record[0] != "":
- locatie = record[1]+"_"+record[0]
- slachtoffers = record[6]
- datum = record[2]
- bestand.readline()
- arraydata.append([locatie, slachtoffers, datum, "coronavirus"])
- else:
- bestand.readline()
- else:
- first = 1
- df = pd.DataFrame(arraydata, columns=['locatie', 'totaal', 'datum', 'virus'], dtype=float)
- print(df)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement