Transaction Table

def get_augmented_table():
    '''
    Replace integrate user_features and item_features
    to the transaction_list
    
    Input
    ------
    none
    
    
    Output
    -------
    augmented_transaction_table  : transaction_list concatenated with user_features
                                   from genres and item_features from movie synopsis
    
    
    '''
    import pandas as pd
    transaction_list, user_feature = create_user_feature(num_transactions = 5000)
    item_feature = create_item_feature()
    augmented_tt = transaction_list.merge(user_feature, on='userId', how='left')
    augmented_tt_2 = augmented_tt.merge(item_feature, on='movieId', how='left')
    
    return augmented_tt_2
    
augmented_transaction_table = get_augmented_table()
augmented_transaction_table.head()
userId movieId rating timestamp u_1 u_2 u_3 u_4 u_5 u_6 ... i_291 i_292 i_293 i_294 i_295 i_296 i_297 i_298 i_299 i_300
0 1 1 4.0 964982703 85 29 42 83 47 26 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
1 1 3 4.0 964981247 85 29 42 83 47 26 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
2 1 6 4.0 964982224 85 29 42 83 47 26 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
3 1 47 5.0 964983815 85 29 42 83 47 26 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
4 1 50 5.0 964982931 85 29 42 83 47 26 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0

5 rows × 324 columns

augmented_transaction_table.shape
(5000, 324)
augmented_transaction_table['userId'].nunique()
32