I have a data frame which contains two columns UserId and movieId. Different users have watched different movies. I want to fetch (e.g. three common movies between two common users).
df = DataFrame({'userId' : [1,2,3,1,3,6,2,4,1,2], 'movieId' : [222,222,900,555,555,888,555,222,666,666]})
The required result should be like this
userId movieId
1 222
1 555
1 666
2 222
2 555
2 666
i do not need other entries which does not contain three common movies for users. For example, if there is another user who watched all three movies should be considered.