Created
March 6, 2014 17:45
-
-
Save jakul/9395379 to your computer and use it in GitHub Desktop.
users and practices with multiple plhone numbers / addresses
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pns = PhoneNumber.objects.filter(content_type=38L).order_by('object_id').values_list('object_id', flat=True) | |
pns2 = [(key, len(list(group))) for key, group in groupby(pns)] | |
[(key, freq) for key, freq in pns2 if freq> 2] | |
3 | |
31 | |
38 | |
pns = Address.objects.filter(content_type=38).order_by('object_id').values_list('object_id', flat=True) | |
pns2 = [(key, len(list(group))) for key, group in groupby(pns)] | |
[(key, freq) for key, freq in pns2 if freq> 1] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment