Skip to content
Snippets Groups Projects
Commit 30cc3cf2 authored by Arshana Jain's avatar Arshana Jain
Browse files

streamlined init_europe.init_ukraine()

parent 207159a4
No related branches found
No related tags found
No related merge requests found
...@@ -21,37 +21,17 @@ def init_italy(): ...@@ -21,37 +21,17 @@ def init_italy():
# Starts on 3/3/2020. # Starts on 3/3/2020.
def init_ukraine(): def init_ukraine():
dt = datetime.datetime.today() dt = datetime.datetime(2020, 3, 3)
for year in range(2020, int(dt.year) + 1): while (True):
start_month = 1 csv_name = 'https://raw.githubusercontent.com/dmytro-derkach/covid-19-ukraine/master/daily_reports/' + ('0' if dt.month < 10 else '') + str(dt.month) + '-' + ('0' if dt.day < 10 else '') + str(dt.day) + '-' + str(dt.year) + '.csv'
if (year == 2020): print(csv_name)
start_month = 3 try:
end_month = 13 df = pd.read_csv(csv_name, error_bad_lines=False)
if (year == int(dt.year)): except:
end_month = int(dt.month) + 1 break
for month in range(start_month, end_month): dt += datetime.timedelta(days=1)
start_day = 1
if (year == 2020 and start_month == 3):
start_day = 3
end_day = 32
if (year == int(dt.year) and month == int(dt.month)):
end_day = dt.day + 1
for day in range(start_day, end_day):
if (isValidDate(year, month, day)):
csv_name = 'https://raw.githubusercontent.com/dmytro-derkach/covid-19-ukraine/master/daily_reports/' + ('0' if month < 10 else '') + str(month) + '-' + ('0' if day < 10 else '') + str(day) + '-' + str(year) + '.csv'
try:
df = pd.read_csv(csv_name, error_bad_lines=False)
except:
print('Ukraine init failed on ' + csv_name)
def init_france(): def init_france():
pass pass
def isValidDate(year, month, day): init_ukraine()
isValidDate = True
try:
datetime.datetime(int(year), int(month), int(day))
except ValueError:
isValidDate = False
return isValidDate
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment