Format dataframe¶
Clean dataframe¶
-
choose_columns(df_covid, col_names)¶ Return a dataframe with only the chosen columns, exctract only interresting columns of df_covid.
- Parameters
df_covid (dataframe) – dataframe with covid data
col_names (list of str) – column names from df_covid
- Returns
dataframe with chosen columns
- Return type
dataframe
-
choose_granularity(df_covid, granularity)¶ Return a dataframe with only the chosen granularity.
- Parameters
df_covid (dataframe) – dataframe with covid data
granularity (str) – element in [“departement”, “region”, “pays”, “monde”]
Format dataframe¶
-
format_granularity(df_covid, granularity)¶ Format the dataframe by changing ‘maille_code’ with the format ‘___-XX’ in the format ‘XX’, according to the granularity. For instance, “DEP-33” becomes “33” or “REG-11” becomes “11”.
- Parameters
df_covid (dataframe) – dataframe with covid data
granularity (str) – region or departement
- Returns
dataframe formated
- Return type
dataframe