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

        Returns:
            tw: A cleaned pandas dataframe
        """

        tw = tw.query('Type == "Total"')
        van_total = tw.sum()
        van_total['LocalArea'] = 'City of Vancouver'
        van_total['Type'] = 'Total'
        tw = tw.append(van_total, ignore_index=True)

        col_lis = list(tw.columns)[4:6]

        for col in col_lis:
            tw[col] = tw[col]/tw[
                'Population 15 years and over by work activity']

        tw = tw[['LocalArea', 'full time', 'part time']]

        return tw

        This function cleans the work time census data
        Args:
            house_type (pd.DataFrame): The dataframe for work time data
            tw (int): census year

        Returns:
            tw: A cleaned pandas dataframe
        
This function cleans the work time census data
This function cleans the work time census data
def clean_time_worked(tw, year):
        tw = tw.query('Type == "Total"')
        van_total = tw.sum()
        van_total['LocalArea'] = 'City of Vancouver'
        van_total['Type'] = 'Total'
        tw = tw.append(van_total, ignore_index=True)
        col_lis = list(tw.columns)[4:6]
        for col in col_lis:
            tw[col] = tw[col]/tw[
                'Population 15 years and over by work activity']
        tw = tw[['LocalArea', 'full time', 'part time']]
        return tw
def clean_time_worked ( tw , year ) : tw = tw . query ( 'Type == "Total"' ) van_total = tw . sum ( ) van_total [ 'LocalArea' ] = 'City of Vancouver' van_total [ 'Type' ] = 'Total' tw = tw . append ( van_total , ignore_index = True ) col_lis = list ( tw . columns ) [ 4 : 6 ] for col in col_lis : tw [ col ] = tw [ col ] / tw [ 'Population 15 years and over by work activity' ] tw = tw [ [ 'LocalArea' , 'full time' , 'part time' ] ] return tw
This function cleans the work time census data
This function cleans the work time census data
"""
        This function cleans the work time census data
        Args:
            house_type (pd.DataFrame): The dataframe for work time data
            tw (int): census year

        Returns:
            tw: A cleaned pandas dataframe
        """
A cleaned pandas dataframe
A cleaned pandas dataframe
tw
tw
None
year
house_type
The dataframe for work time data
The dataframe for work time data