Skip to content
Advertisement

Pandas filtering based on minimum data occurrences across multiple columns

I have a dataframe like this

JavaScript

I want those data_fingerprint for where the organisation and country with top 2 counts exists

So if see in organization top 2 occurrences are for Tesco,Yahoo and for country we have US,UK .

So based on that the output of data_fingerprint should be having

JavaScript

What i have tried for organization to exist in my complete dataframe is this

JavaScript

But i am not getting any data here.Once i get data for this I can do it along with country Can someone please help to get me the output.I have less data so using Pandas

Advertisement

Answer

here is one way to do it

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