Utility function for dealing with dhs data

load_column_config[source]

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 Default Details
country str 2 letter character representing the country

load_dhs_file[source]

load_dhs_file(household_data:str)

Loads household data and renames columns based on variable labels of the file

Type Default Details
household_data str str or pathlike object to the household data

apply_threshold[source]

apply_threshold(df:DataFrame, columns:List[str], config:dict)

Applies a threshold to a list of columns

Type Default Details
df DataFrame Dataframe
columns typing.List[str] List of columns to apply the threshold
config dict Config containing the min and max of each columns

assign_wealth_index[source]

assign_wealth_index(asset_df: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