I have this DataFrame:
user_id ip
0 2 106.184.2.137
1 2 106.184.2.137
2 3 106.184.2.113
3 3 106.184.2.112
4 9 103.105.111.191
5 9 103.105.111.191
6 11 103.239.29.190
How can I get the number of unique ip addresses per user id as follows:
user_id ip_num
0 2 1
1 3 2
2 9 1
3 11 1
thank you for your help.