src/04_visualization/census_vis_synthesis.py
def clean_household_type(house_type, year):
        """
        This function cleans the household type census data
        Args:
            house_type (pd.DataFrame): The dataframe for household type data
            year (int): census year

        Returns:
            house_type: A cleaned pandas dataframe
        """

        for i in house_type.columns[3:]:
            house_type[i] = house_type[i]/house_type[house_type.columns[2]]

        house_type = house_type.iloc[:, [1, 3, 4, 5]]

        house_type.columns = ['LocalArea',
                              'One-family households',
                              'Multiple-family households',
                              'Non-family households']

        return house_type

        This function cleans the household type census data
        Args:
            house_type (pd.DataFrame): The dataframe for household type data
            year (int): census year

        Returns:
            house_type: A cleaned pandas dataframe
        
This function cleans the household type census data
This function cleans the household type census data
def clean_household_type(house_type, year):
        for i in house_type.columns[3:]:
            house_type[i] = house_type[i]/house_type[house_type.columns[2]]
        house_type = house_type.iloc[:, [1, 3, 4, 5]]
        house_type.columns = ['LocalArea',
                              'One-family households',
                              'Multiple-family households',
                              'Non-family households']
        return house_type
def clean_household_type ( house_type , year ) : for i in house_type . columns [ 3 : ] : house_type [ i ] = house_type [ i ] / house_type [ house_type . columns [ 2 ] ] house_type = house_type . iloc [ : , [ 1 , 3 , 4 , 5 ] ] house_type . columns = [ 'LocalArea' , 'One-family households' , 'Multiple-family households' , 'Non-family households' ] return house_type
This function cleans the household type census data
This function cleans the household type census data
"""
        This function cleans the household type census data
        Args:
            house_type (pd.DataFrame): The dataframe for household type data
            year (int): census year

        Returns:
            house_type: A cleaned pandas dataframe
        """
A cleaned pandas dataframe
A cleaned pandas dataframe
house_type
house_type
The dataframe for household type data
The dataframe for household type data
year
None