created basic dataframes

This commit is contained in:
Rory Healy 2021-04-09 22:46:35 +10:00
parent 4af42c9144
commit 6a41b385e7
3 changed files with 148008 additions and 0 deletions

73994
data/owid-covid-data.csv Normal file

File diff suppressed because it is too large Load diff

73994
output.csv Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,2 +1,22 @@
import pandas as pd
import argparse
all_covid_data = pd.read_csv('data/owid-covid-data.csv', encoding = 'ISO-8859-1')
reduced_data = all_covid_data.loc[:,['location', 'date', 'total_cases', 'new_cases', 'total_deaths', 'new_deaths']]
# reduced_data_grouped = reduced_data.groupby(['location', 'date'], as_index = False)
new_cases = all_covid_data.loc[:, ['location', 'date', 'new_cases']]
new_cases.date = pd.to_datetime(new_cases.date)
new_cases_grouped = new_cases.groupby([new_cases.date.dt.month, new_cases.location]).new_cases.sum()
new_deaths = all_covid_data.loc[:, ['location', 'date', 'new_deaths']]
new_deaths.date = pd.to_datetime(new_deaths.date)
new_deaths_grouped = new_deaths.groupby([new_deaths.date.dt.month, new_deaths.location]).new_deaths.sum()
print(new_cases_grouped)
print("\n\n")
print(new_deaths_grouped)