Open alexazhu opened 3 years ago
Good catch! I was thinking maybe I'll create another index to store "deaths" or "cases", or maybe both! This way I'll replace the sub["cases"] or sub["deaths"] by sub[index] and merge these two functions into one! Or I can make the output a list of result = (cases, deaths) and do result[0] and result[1] to select the proper value.
for line 19-25 in function.py, I think they can be merged into one function since they have the same value for
sub
; maybe set "death" or "cases" as input to call for reduce function. In this way, we can save the lines for cumm_deathsdef cumm_cases(data, start_date, end_date): sub = data.loc[(data["date"] >= start_date) & (data["date"] <= end_date)] return reduce(lambda x,y: x+y, sub["cases"]
def cumm_deaths(data, start_date, end_date): sub = data.loc[(data["date"] >= start_date) & (data["date"] <= end_date)] return reduce(lambda x,y: x+y, sub["deaths"])
Thanks ;)