Skip to content
Advertisement

Group by column on basis of occurrences

This is my dataframe:

JavaScript

This is how my dataframe looklike:

JavaScript

I first counted the no of items for each user using the following code:

JavaScript

This is how it looks:

JavaScript

I want to remove a user who is coming 1 time and also observation is 1. For example user nemo and cokie. But I don’t want to remove user alex, even though items a and b are coming 1 time or user ravi.

How can I do it?

My end goal:

JavaScript

Advertisement

Answer

This works:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement