I have a dataframe that looks as the following:
ip_address malware_type
ip_1 malware_1
ip_2 malware_2
ip_1 malware_1
ip_1 malware_1
ip_1 malware_2
ip_2 malware_2
ip_2 malware_3
.
.
.
I want to drop duplicate rows based on the 'ip_address' column, however when the dropping occurs, I want to keep only the 'malware_type' value that is the most frequent for each IP. So the resulting dataframe should look like:
ip_address malware_type
ip_1 malware_1
ip_2 malware_2
.
.
.
I would really appreciate any help to achieve the above. Thanks.