DHS Utilities
utility function for dealing with DHS data
load_column_config
load_column_config (country:str)
Get predined column mapping for some countries. The following countries area supported: - ph Philippines - tl East Timor - mm Myanmar - kh Cambodia
| Type | Details | |
|---|---|---|
| country | str | 2 letter character representing the country |
| Returns | dict |
load_dhs_file
load_dhs_file (household_data:str)
Loads household data and renames columns based on variable labels of the file
| Type | Details | |
|---|---|---|
| household_data | str | str or pathlike object to the household data |
| Returns | DataFrame |
apply_threshold
apply_threshold (df:pandas.core.frame.DataFrame, columns:List[str], config:dict)
Applies a threshold to a list of columns
| Type | Details | |
|---|---|---|
| df | DataFrame | Dataframe |
| columns | List | List of columns to apply the threshold |
| config | dict | Config containing the min and max of each columns |
| Returns | DataFrame |
assign_wealth_index
assign_wealth_index (asset_df:pandas.core.frame.DataFrame, use_pca=True)
| Type | Default | Details | |
|---|---|---|---|
| asset_df | DataFrame | Dataframe containg only the features to apply wealth index | |
| use_pca | bool | True | if calculating wealth index should be done via PCA or via Sigular Value Decomposition |