def create_avg_stoplines_df(stoplines_df_name):
    """Create an aggregated stoplines_avg_df with the average stopline X, Y for each link and number of lanes"""
    stopline_avg_df = stoplines_df_name.groupby('Link_ID')['stopline_X'].mean().reset_index(name='mean_X')
    stopline_avg_df['mean_Y'] = stoplines_df_name.groupby('Link_ID')['stopline_Y'].mean().reset_index(name='mean_Y').iloc[:,1]
    stopline_avg_df['n_lanes'] = stoplines_df_name.groupby('Link_ID')['Lane'].count().reset_index().iloc[:,1]
    stopline_avg_df['link_direction'] = stoplines_df_name.groupby('Link_ID')['Link_direction'].first().reset_index().iloc[:,1]
    #print(stopline_avg_df.head())
    return stopline_avg_df