def add_dep_delay_Ndays_rolling(df, days, shift):
    """
    This function adds additional column with N-days rolling mean for departure delay per origin airport.
    Args:
        df - Dataframe with flights information
        days - Number of days to calculate rolling mean
        shift - Days to offset calculation into the past.
    Output:
        df - processed dataframe with additional column
    """
    #Calculating average for aiport per day
    dep_delay_df = df[['fl_date', 'dep_delay','origin_airport_id']].groupby(
                ['origin_airport_id', 'fl_date']).mean().reset_index()
    #Calculate rolling average per airport
    dep_delay_df=dep_delay_df[['fl_date', 'dep_delay','origin_airport_id']].groupby(
            'origin_airport_id').rolling(days, on='fl_date', min_periods=2).agg({'dep_delay':'mean'}).shift(shift).reset_index()
    
    dep_delay_df.rename(columns={'dep_delay':str(days) + ' days roll dep_delay'}, inplace=True)
    
    #Merging with initial DataFrame
    df=df.merge(dep_delay_df, on=['origin_airport_id', 'fl_date' ] , how='left')
    return df