Skip to content

Instantly share code, notes, and snippets.

@spenthil
Created May 16, 2012 20:41
Show Gist options
  • Save spenthil/2713766 to your computer and use it in GitHub Desktop.
Save spenthil/2713766 to your computer and use it in GitHub Desktop.
claims in a state that have an email associated with it
from collections import Counter
state = 'bpi'
result = Counter(x.endswith("counsyl.com") for x in InsuranceClaim.objects.filter(status=state).values_list('orderkit__order__profile__user__email', flat=True))
total = sum(result.values()) / 100.0
percentages = {k:int(v/total) for k,v in result.iteritems()}
print percentages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment