scripts.household

Define functions to count households by income, household type, age and household size.

This module provides functions for processing household demographic data from SOEP (Socio-Economic Panel) surveys. The functions handle encoding transformations, classification of households, and calculation of income quintiles.

Functions defined in this script:
  • household_types: Replace encoding of household types with custom encoding

  • size_class: Assign household size class to every person

  • age_class: Assign age classes to every person

  • income_quintiles: Calculate weighted income quintiles

Disaggregation of households in inhabit matrix:

Region –> Income Quantile –> household type –> age –> number of people

Functions are applied in “inhabit_matrix.py”.

Functions

age_class(df, ip, col_name)

Assign age classes to every person.

household_types(df, ip, col_name)

Replace encoding of household types with custom encoding.

income_quintiles(df, ip, col_name)

Calculate weighted income quintiles for DataFrame and add them in new column.

size_class(df, ip, col_name)

Assign household size class to every person.