def create_user_item_matrix(df):
    '\n    INPUT:\n    df - pandas dataframe with article_id, title, user_id columns\n    \n    OUTPUT:\n    user_item - user item matrix \n    \n    Description:\n    Return a matrix with user ids as rows and article ids on the columns with 1 values where a user interacted with \n    an article and a 0 otherwise\n    '
    user_item = df.groupby('user_id')['article_id'].value_counts().unstack()
    user_item[(user_item.isna() == False)] = 1
    return user_item
INPUT:
df - pandas dataframe with article_id, title, user_id columns

OUTPUT:
user_item - user item matrix 

Description:
Return a matrix with user ids as rows and article ids on the columns with 1 values where a user interacted with 
an article and a 0 otherwise
def create_user_item_matrix(df):
    '\n    INPUT:\n    df - pandas dataframe with article_id, title, user_id columns\n    \n    OUTPUT:\n    user_item - user item matrix \n    \n    Description:\n    Return a matrix with user ids as rows and article ids on the columns with 1 values where a user interacted with \n    an article and a 0 otherwise\n    '
    user_item = df.groupby('user_id')['article_id'].value_counts().unstack()
    user_item[(user_item.isna() == False)] = 1
    return user_item