I have a dataframe of writers like this:
writer_id | titles |
---|---|
n1 | t1,t2 |
n2 | t3,t4 |
And I have another dataframe for the titles with genre, ratings and votes like this:
title_id | genres | votes | rating |
---|---|---|---|
t1 | Drama,Action | 100 | 7.0 |
t2 | Action,Thriller | 1000 | 8.0 |
t3 | Crime ,Romance | 200 | 6.0 |
t4 | Drama,Romance | 300 | 5.0 |
Now in the new data frame, I want to have a row for each writer with columns for each genre with the count value and another column (let's call it popularity) that will apply a formula using votes and rating. So it would look like this:
writer_id | drama | action | thriller | romance | crime | popularity |
---|---|---|---|---|---|---|
n1 | 1 | 2 | 1 | 0 | 0 | 2.2 |
n2 | 0 | 1 | 0 | 2 | 1 | 4.2 |
How should I go about doing this? I have the columns with genres already created.
2.2
? what isw
forwriter_id=n1
? – jezrael