def time_gap_shift_2_features(data_df, mini_data_df):
    """
    For each member, compute:
    1. time gap between current booking date and second last booking date/next-to-next booking date
    2. time gap between current checkin date and second last checkin date/next-to-next checkin date
    :param data_df: full_data
    :param mini_data_df: mini_data
    :return: modified mini_data
    """
    # Compute time gap between current booking date and second last booking date/next-to-next booking date (shift 2)
    # for each memberid and add it to mini_data
    data_df['prev2_booking_date_in_seconds'] = data_df.groupby('memberid')['booking_date_in_seconds'].shift(2)
    mini_data_df['time_gap_booking_prev2'] = data_df['booking_date_in_seconds'] - data_df[
        'prev2_booking_date_in_seconds']

    data_df['next2_booking_date_in_seconds'] = data_df.groupby('memberid')['booking_date_in_seconds'].shift(-2)
    mini_data_df['time_gap_booking_next2'] = data_df['next2_booking_date_in_seconds'] - data_df[
        'booking_date_in_seconds']

    # Compute time gap between current checkin date and second last checkin date/next-to-next checkin date (shift 2)
    # for each memberid and add it to mini_data
    data_df['prev2_checkin_date_in_seconds'] = data_df.groupby('memberid')['checkin_date_in_seconds'].shift(2)
    mini_data_df['time_gap_checkin_prev2'] = data_df['checkin_date_in_seconds'] - data_df[
        'prev_checkin_date_in_seconds']

    data_df['next2_checkin_date_in_seconds'] = data_df.groupby('memberid')['checkin_date_in_seconds'].shift(-2)
    mini_data_df['time_gap_checkin_next2'] = data_df['next2_checkin_date_in_seconds'] - data_df[
        'checkin_date_in_seconds']

    return mini_data_df