我试图弄清楚如何按每对唯一列(ip,useragent)的行数来计算,例如
d = pd.DataFrame({'ip': ['192.168.0.1', '192.168.0.1', '192.168.0.1', '192.168.0.2'], 'useragent': ['a', 'a', 'b', 'b']})
ip useragent
0 192.168.0.1 a
1 192.168.0.1 a
2 192.168.0.1 b
3 192.168.0.2 b
生产:
ip useragent
192.168.0.1 a 2
192.168.0.1 b 1
192.168.0.2 b 1
想法?