importpandasaspdfromcowidevimportPATHSfromcowidev.utils.cleanimportclean_date_seriesfromcowidev.utils.web.downloadimportread_csv_from_urlMETADATA_BASE={"source_url":"https://opendata.ecdc.europa.eu/covid19/hospitalicuadmissionrates/csv/data.csv","source_url_ref":"https://www.ecdc.europa.eu/en/publications-data/download-data-hospital-and-icu-admission-rates-and-current-occupancy-covid-19","source_name":"European Centre for Disease Prevention and Control",}POPULATION=pd.read_csv(PATHS.INTERNAL_INPUT_UN_POPULATION_FILE,usecols=["entity","population"],)EXCLUDED_COUNTRIES=["Austria","Belgium","Czechia","Denmark","Finland","France","Germany","Italy","Netherlands","Portugal","Spain","Sweden",]
[docs]defpipe_undo_100k(df):df=pd.merge(df,POPULATION,on="entity",how="left")assertdf[df.population.isna()].shape[0]==0,"Country missing from population file"df.loc[df["indicator"].str.contains(" per 100k"),"value"]=df["value"].div(100000).mul(df["population"])df.loc[:,"indicator"]=df["indicator"].str.replace(" per 100k","")returndf