Zählen Sie eindeutige Werte mit Pandas pro Gruppe [duplizieren]
Diese Frage hat hier bereits eine Antwort:
Pandas count (distinct) equivalent 5 AntwortenIch muss eindeutig zählenID
Werte in jedemdomain
Ich habe Daten
ID, domain
123, 'vk.com'
123, 'vk.com'
123, 'twitter.com'
456, 'vk.com'
456, 'facebook.com'
456, 'vk.com'
456, 'google.com'
789, 'twitter.com'
789, 'vk.com'
Ich versuchedf.groupby(['domain', 'ID']).count()
Aber ich will @ bekomm
domain, count
vk.com 3
twitter.com 2
facebook.com 1
google.com 1