I am trying to show user articles based on his user activity.
My user activity table has 3 columns ID,Category,Name So basically once a user read/click article these "three" fields updates based on which category of article he selected
Now based on his user activity i would like to show 10 articles from articles table based on which category of article he selected most for example
Category # of articles read
Sports 7
Weather 3
So the recommendation page should select 7 articles from sports category and 3 articles from weather category
Here is the code i have done so far
#Reading Articles from CSV
articles = pd.read_csv('articles.csv')
#User Activity Data
data = pd.read_csv('atc.csv',nrows=2000)
data1=data.rename(columns={'Category ':'Category'})
user_ac = data1[data1.Name=="Roxana"]
# number of articles read by 'Roxana' for each category
calc = user_ac.groupby('Category').count()['ID ']
#Sorting
sorted = calc.sort_values(ascending=False)
#Find probability for each category
b = user_ac.groupby('Category').count().div(len(user_ac))['ID ']
b=b.sort_values(ascending=False)
n_recommendation = 10
How can i achieve this using pandas ?
GDRIVE LINK OF USER ACTIVITY https://drive.google.com/file/d/1d6rG0TE3dGYuU41AfTwn5T7dyoDniElY/view?usp=sharing
GDRIVE LINK OF Articles Data https://drive.google.com/file/d/15cK4p9vonmNNRZ_C5d26ULRivx6zSkrE/view?usp=sharing