def filter_by_count(df, group_col, filter_col, num):
    """Filter out the group_col column values that have a less than num count of filter_col.

    Args:
        df (DataFrame): interaction DataFrame to be processed.
        group_col (string): column name to be filtered.
        filter_col (string): column with the filter condition.
        num (int): minimum count condition that should be filter out.

    Returns:
        DataFrame: The filtered interactions.

    """
    ordercount = (
        df.groupby([group_col])[filter_col].nunique().rename("count").reset_index()
    )
    filter_df = df[
        df[group_col].isin(ordercount[ordercount["count"] >= num][group_col])
    ]
    return filter_df