src/02_clean_wrangle/06_synthesis.py
def fill_missing_year(df, start_year, end_year):
        """
        This function will repeat the dataframe and fill the year
        from the start to end
        Args:
            df (pandas dataframe): The dataframe
            start_year (int): The four digit start year
            end_year (int): The four digit end year, note end year not included

        Returns:
            df: The expanded dataframe

        """
        assert ~(df.empty), 'Input dataframe is empty'
        assert check_columns(df, ['LocalArea']), 'Input dataframe should have LocalArea column'
        assert start_year<end_year, 'Start year should be smaller than end year'
        assert 0<start_year and 0<end_year, 'Start year and end year should be positive number'

        df = df[~((
            df.LocalArea == 'Vancouver CMA') | (
            df.LocalArea == 'Vancouver CSD'))]

        year_lis = list(range(start_year, end_year))
        df = pd.concat([df]*len(year_lis))
        df.reset_index(drop=True, inplace=True)
        df['Year'] = 0
        i = 0

        for year in year_lis:
            df.iloc[i:i+22]['Year'] = year
            i += 22

        return df

        This function will repeat the dataframe and fill the year
        from the start to end
        Args:
            df (pandas dataframe): The dataframe
            start_year (int): The four digit start year
            end_year (int): The four digit end year, note end year not included

        Returns:
            df: The expanded dataframe

        
This function will repeat the dataframe and fill the year
from the start to end
This function will repeat the dataframe and fill the year from the start to end
def fill_missing_year(df, start_year, end_year):
        assert ~(df.empty), 'Input dataframe is empty'
        assert check_columns(df, ['LocalArea']), 'Input dataframe should have LocalArea column'
        assert start_year<end_year, 'Start year should be smaller than end year'
        assert 0<start_year and 0<end_year, 'Start year and end year should be positive number'
        df = df[~((
            df.LocalArea == 'Vancouver CMA') | (
            df.LocalArea == 'Vancouver CSD'))]
        year_lis = list(range(start_year, end_year))
        df = pd.concat([df]*len(year_lis))
        df.reset_index(drop=True, inplace=True)
        df['Year'] = 0
        i = 0
        for year in year_lis:
            df.iloc[i:i+22]['Year'] = year
            i += 22
        return df
def fill_missing_year ( df , start_year , end_year ) : assert ~ ( df . empty ) , 'Input dataframe is empty' assert check_columns ( df , [ 'LocalArea' ] ) , 'Input dataframe should have LocalArea column' assert start_year < end_year , 'Start year should be smaller than end year' assert 0 < start_year and 0 < end_year , 'Start year and end year should be positive number' df = df [ ~ ( ( df . LocalArea == 'Vancouver CMA' ) | ( df . LocalArea == 'Vancouver CSD' ) ) ] year_lis = list ( range ( start_year , end_year ) ) df = pd . concat ( [ df ] * len ( year_lis ) ) df . reset_index ( drop = True , inplace = True ) df [ 'Year' ] = 0 i = 0 for year in year_lis : df . iloc [ i : i + 22 ] [ 'Year' ] = year i += 22 return df
This function will repeat the dataframe and fill the year
from the start to end
This function will repeat the dataframe and fill the year from the start to end
"""
        This function will repeat the dataframe and fill the year
        from the start to end
        Args:
            df (pandas dataframe): The dataframe
            start_year (int): The four digit start year
            end_year (int): The four digit end year, note end year not included

        Returns:
            df: The expanded dataframe

        """
The expanded dataframe
The expanded dataframe
df
df
None
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