def get_n_interaction(df, user_col='user_id', weight_dic = None):
    """ 
    Returns a dataframe with:
    user_id | item_id | n_interactions
    - Input:
        df -> pandas dataframe
        user_col -> name of the user column
        weight_dic -> weight for each type of interaction
    """
    if(weight_dic == None):
        df = df[[user_col,'reference']]
        df = (
            df
            .groupby([user_col, "reference"])
            .size()
            .reset_index(name="n_interactions")
        )
    else:
        df = df.replace({'action_type': weight_dic})
        df = df[[user_col,'reference', 'action_type']]
        df = df.groupby([user_col, "reference"])['action_type'].agg('sum').reset_index(name='n_interactions')
    return df