src/02_clean_wrangle/06_synthesis.py
def clean_marital_status(marital, start_year, end_year):
        """
        This function cleans the marital census data
        Args:
            marital (pandas dataframe): The dataframe for language data
            start_year (int): The four digit start year
            end_year (int): The four digit end year, note end year not included

        Returns:
            marital: A cleaned pandas dataframe

        """
        assert check_columns(marital, ['LocalArea',
                           'Married or living with a or common-law partner',
                           'Not living with a married spouse or common-law partner']), 'Input dataframe does not have all columns required'

        marital['Married or living with a or common-law partner'] = marital[
            'Married or living with a or common-law partner'] / \
            marital['Total population 15 years and over']
        marital[
            'Not living with a married spouse or common-law partner'] = \
            marital[
                'Not living with a married spouse or common-law partner'] / \
            marital['Total population 15 years and over']

        if start_year == 2007 or start_year == 2012:
            marital = marital.query('Type == "total"')

        marital = marital[['LocalArea',
                           'Married or living with a or common-law partner',
                           'Not living with a married spouse or common-law partner']]

        marital = fill_missing_year(marital, start_year, end_year)
        return marital

        This function cleans the marital census data
        Args:
            marital (pandas dataframe): The dataframe for language data
            start_year (int): The four digit start year
            end_year (int): The four digit end year, note end year not included

        Returns:
            marital: A cleaned pandas dataframe

        
This function cleans the marital census data
This function cleans the marital census data
def clean_marital_status(marital, start_year, end_year):
        assert check_columns(marital, ['LocalArea',
                           'Married or living with a or common-law partner',
                           'Not living with a married spouse or common-law partner']), 'Input dataframe does not have all columns required'
        marital['Married or living with a or common-law partner'] = marital[
            'Married or living with a or common-law partner'] / \
            marital['Total population 15 years and over']
        marital[
            'Not living with a married spouse or common-law partner'] = \
            marital[
                'Not living with a married spouse or common-law partner'] / \
            marital['Total population 15 years and over']
        if start_year == 2007 or start_year == 2012:
            marital = marital.query('Type == "total"')
        marital = marital[['LocalArea',
                           'Married or living with a or common-law partner',
                           'Not living with a married spouse or common-law partner']]
        marital = fill_missing_year(marital, start_year, end_year)
        return marital
def clean_marital_status ( marital , start_year , end_year ) : assert check_columns ( marital , [ 'LocalArea' , 'Married or living with a or common-law partner' , 'Not living with a married spouse or common-law partner' ] ) , 'Input dataframe does not have all columns required' marital [ 'Married or living with a or common-law partner' ] = marital [ 'Married or living with a or common-law partner' ] / marital [ 'Total population 15 years and over' ] marital [ 'Not living with a married spouse or common-law partner' ] = marital [ 'Not living with a married spouse or common-law partner' ] / marital [ 'Total population 15 years and over' ] if start_year == 2007 or start_year == 2012 : marital = marital . query ( 'Type == "total"' ) marital = marital [ [ 'LocalArea' , 'Married or living with a or common-law partner' , 'Not living with a married spouse or common-law partner' ] ] marital = fill_missing_year ( marital , start_year , end_year ) return marital
This function cleans the marital census data
This function cleans the marital census data
"""
        This function cleans the marital census data
        Args:
            marital (pandas dataframe): The dataframe for language data
            start_year (int): The four digit start year
            end_year (int): The four digit end year, note end year not included

        Returns:
            marital: A cleaned pandas dataframe

        """
A cleaned pandas dataframe
A cleaned pandas dataframe
marital
marital
The dataframe for language data
The dataframe for language data
start_year
The four digit start year
The four digit start year
end_year
The four digit end year, note end year not included
The four digit end year note end year not included