I a m working on this Data Set I want to get cumulative confirmed cases so I filtered by confirmed cases, grouped by Date and aggregated by sum.
import matplotlib.pyplot as plt
covid_tab=pd.read_csv('datasets/COVID-19 Cases.csv')
covid_tab['Date']=pd.to_datetime(covid_tab['Date'])
covid_tab.groupby(["Country_Region","Case_Type"]).agg({'Cases':'max'}).head()
cumulative_cases=covid_tab[covid_tab['Case_Type']=='Confirmed'].groupby('Date').agg({'Cases': 'sum'})
cumulative_cases.head()
I get something like this
but if I try to access the Date column I get a Key error, or if I try to print the column names I only get 'Cases' printed
Why is that?