src/04_visualization/census_vis_synthesis.py
def clean_gender(gender, year):
        """
        This function cleans the population gender census data
        Args:
            gender (pd.DataFrame): The dataframe for gender data
            year (int): census year

        Returns:
            gender: A cleaned pandas dataframe
        """

        gender = gender.iloc[:, 1:4].pivot(
            index='LocalArea', columns='Type', values='Total'
            ).reset_index()

        gender['female'] = gender['female'] / gender['total']
        gender['male'] = gender['male'] / gender['total']

        gender = gender[['LocalArea',
                         'female',
                         'male']]

        return gender

        This function cleans the population gender census data
        Args:
            gender (pd.DataFrame): The dataframe for gender data
            year (int): census year

        Returns:
            gender: A cleaned pandas dataframe
        
This function cleans the population gender census data
This function cleans the population gender census data
def clean_gender(gender, year):
        gender = gender.iloc[:, 1:4].pivot(
            index='LocalArea', columns='Type', values='Total'
            ).reset_index()
        gender['female'] = gender['female'] / gender['total']
        gender['male'] = gender['male'] / gender['total']
        gender = gender[['LocalArea',
                         'female',
                         'male']]
        return gender
def clean_gender ( gender , year ) : gender = gender . iloc [ : , 1 : 4 ] . pivot ( index = 'LocalArea' , columns = 'Type' , values = 'Total' ) . reset_index ( ) gender [ 'female' ] = gender [ 'female' ] / gender [ 'total' ] gender [ 'male' ] = gender [ 'male' ] / gender [ 'total' ] gender = gender [ [ 'LocalArea' , 'female' , 'male' ] ] return gender
This function cleans the population gender census data
This function cleans the population gender census data
"""
        This function cleans the population gender census data
        Args:
            gender (pd.DataFrame): The dataframe for gender data
            year (int): census year

        Returns:
            gender: A cleaned pandas dataframe
        """
A cleaned pandas dataframe
A cleaned pandas dataframe
gender
gender
The dataframe for gender data
The dataframe for gender data
year
None