DHS Utilities
utility function for dealing with DHS data
load_column_config
def load_column_config(
country:str, # 2 letter character representing the country
)->dict:
Get predined column mapping for some countries. The following countries area supported: - ph Philippines - tl East Timor - mm Myanmar - kh Cambodia
load_dhs_file
def load_dhs_file(
household_data:str, # str or pathlike object to the household data
)->DataFrame:
Loads household data and renames columns based on variable labels of the file
apply_threshold
def apply_threshold(
df:DataFrame, # Dataframe
columns:List, # List of columns to apply the threshold
config:dict, # Config containing the min and max of each columns
)->DataFrame:
Applies a threshold to a list of columns
assign_wealth_index
def assign_wealth_index(
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
):