✨ The fetch method to retrieve the latest stats file works now

This commit is contained in:
Paddy committed 2020-03-29 11:45:00 +02:00
1 parent b8ac53724d
commit b8c9b58cc2
4 files changed
+33 -13

No files matched your search

+1 -1
View File
@@ -30,7 +30,7 @@ class Analyser:
pd.set_option('display.max_row', 50)
pd.set_option('display.max_column', 10)
df = pd.read_csv('2020-03-28_11-00.csv', encoding='windows-1252')
df = pd.read_csv('statsfile.csv')
df['dateRep'] = pd.to_datetime(df['dateRep'])
def getAvailableCountries(self):
+18 -1
View File
@@ -3,4 +3,21 @@
Project: Analyse worldwide COVID-19 Data and provide graphs etc.
@author Patrick Müller
"""
"""
import requests
import csv
def updateStatsFile():
url = 'https://opendata.ecdc.europa.eu/covid19/casedistribution/csv'
resp = requests.get(url, allow_redirects=True)
with open('statsfile.csv', 'w') as file:
# Save the fetched csv String to a variable to be able to mutate it
writeString = str(resp.content)
# Remove the first 2 characters and the very last character because these are some crap that we dont need
writeString = writeString[2:len(writeString)-1]
# Replace the crappy windows newline thingy with the beautiful unix newline char
writeString = writeString.replace('\\r\\n', '\n')
# Write the final string to the file
file.write(writeString)
# Done we are
file.close()
+3
View File
@@ -9,5 +9,8 @@ import Analyser as ana
if __name__ == '__main__':
analyser = ana.Analyser()
print(analyser.getAvailableCountries())
country = input('What country do you want the graph for: ')
analyser.getCasesGraph(country, start_date='2020-02-14')
print(analyser.getTotalCases(country))
fetcher.updateStatsFile()
+11 -11
View File
@@ -120,7 +120,7 @@ dateRep,day,month,year,cases,deaths,countriesAndTerritories,geoId,countryterrito
16/03/2020,16,3,2020,3,0,Andorra,AD,AND,77006
14/03/2020,14,3,2020,1,0,Andorra,AD,AND,77006
03/03/2020,3,3,2020,1,0,Andorra,AD,AND,77006
28/03/2020,28,3,2020,101,105,Argentina,AR,ARG,44494502
28/03/2020,28,3,2020,101,5,Argentina,AR,ARG,44494502
27/03/2020,27,3,2020,87,4,Argentina,AR,ARG,44494502
26/03/2020,26,3,2020,115,2,Argentina,AR,ARG,44494502
25/03/2020,25,3,2020,86,2,Argentina,AR,ARG,44494502
@@ -325,8 +325,8 @@ dateRep,day,month,year,cases,deaths,countriesAndTerritories,geoId,countryterrito
20/03/2020,20,3,2020,2,0,Aruba,AW,ABW,105845
13/03/2020,13,3,2020,2,0,Aruba,AW,ABW,105845
28/03/2020,28,3,2020,212,0,Australia,AU,AUS,24992369
27/03/2020,27,3,2020,743,5,Australia,AU,AUS,24992369
26/03/2020,26,3,2020,0,0,Australia,AU,AUS,24992369
27/03/2020,27,3,2020,367,2,Australia,AU,AUS,24992369
26/03/2020,26,3,2020,376,3,Australia,AU,AUS,24992369
25/03/2020,25,3,2020,600,1,Australia,AU,AUS,24992369
24/03/2020,24,3,2020,114,0,Australia,AU,AUS,24992369
23/03/2020,23,3,2020,611,0,Australia,AU,AUS,24992369
@@ -1660,12 +1660,12 @@ dateRep,day,month,year,cases,deaths,countriesAndTerritories,geoId,countryterrito
15/03/2020,15,3,2020,0,0,Cuba,CU,CUB,11338138
14/03/2020,14,3,2020,1,0,Cuba,CU,CUB,11338138
12/03/2020,12,3,2020,3,0,Cuba,CU,CUB,11338138
28/03/2020,28,3,2020,1,0,Curaçao,CW,CUW,159849
27/03/2020,27,3,2020,1,0,Curaçao,CW,CUW,159849
26/03/2020,26,3,2020,0,1,Curaçao,CW,CUW,159849
24/03/2020,24,3,2020,3,0,Curaçao,CW,CUW,159849
20/03/2020,20,3,2020,2,0,Curaçao,CW,CUW,159849
13/03/2020,13,3,2020,1,0,Curaçao,CW,CUW,159849
28/03/2020,28,3,2020,1,0,Cura\xe7ao,CW,CUW,159849
27/03/2020,27,3,2020,1,0,Cura\xe7ao,CW,CUW,159849
26/03/2020,26,3,2020,0,1,Cura\xe7ao,CW,CUW,159849
24/03/2020,24,3,2020,3,0,Cura\xe7ao,CW,CUW,159849
20/03/2020,20,3,2020,2,0,Cura\xe7ao,CW,CUW,159849
13/03/2020,13,3,2020,1,0,Cura\xe7ao,CW,CUW,159849
28/03/2020,28,3,2020,16,2,Cyprus,CY,CYP,1189265
27/03/2020,27,3,2020,14,0,Cyprus,CY,CYP,1189265
26/03/2020,26,3,2020,8,0,Cyprus,CY,CYP,1189265
@@ -4806,8 +4806,8 @@ dateRep,day,month,year,cases,deaths,countriesAndTerritories,geoId,countryterrito
22/03/2020,22,3,2020,2,0,New_Caledonia,NC,NCL,284060
21/03/2020,21,3,2020,2,0,New_Caledonia,NC,NCL,284060
28/03/2020,28,3,2020,78,0,New_Zealand,NZ,NZL,4885500
27/03/2020,27,3,2020,55,0,New_Zealand,NZ,NZL,4885500
26/03/2020,26,3,2020,94,0,New_Zealand,NZ,NZL,4885500
27/03/2020,27,3,2020,76,0,New_Zealand,NZ,NZL,4885500
26/03/2020,26,3,2020,73,0,New_Zealand,NZ,NZL,4885500
25/03/2020,25,3,2020,47,0,New_Zealand,NZ,NZL,4885500
24/03/2020,24,3,2020,40,0,New_Zealand,NZ,NZL,4885500
23/03/2020,23,3,2020,36,0,New_Zealand,NZ,NZL,4885500
Internal Server Error - Pluto Development Git
500 Internal Server Error

An error occurred:

An error occurred