[docs]def_owid_format(df):print("Reshaping to OWID format…")df.loc[:,"value"]=df["value"].round(3)df=df.drop(columns="iso_code")# Data cleaningdf=df[-df["indicator"].str.contains("Weekly new plot admissions")]df["date"]=df.date.astype(str).str.slice(0,10)df=df.groupby(["entity","date","indicator"],as_index=False).max()df=df.pivot_table(index=["entity","date"],columns="indicator").value.reset_index()df=df.rename(columns={"entity":"Country"})returndf
[docs]def_date_to_owid_year(df):print("Converting dates to grapher years…")df.loc[:,"date"]=(pd.to_datetime(df.date,format="%Y-%m-%d")-zero_day).dt.daysdf=df.rename(columns={"date":"Year"})returndf
[docs]defrun_db_updater():dataset_name=get_filename(DATA_HOSP_GRAPHER_FILE)GrapherBaseUpdater(dataset_name=dataset_name,source_name=f"Official data collated by Our World in Data – Last updated {time_str_grapher()}",zero_day=ZERO_DAY,slack_notifications=False,).run()