Skip to content

Instantly share code, notes, and snippets.

@drkane
Created November 23, 2020 12:24
Show Gist options
  • Save drkane/9e3067a82d108b8cfd349d11d4ce25e9 to your computer and use it in GitHub Desktop.
Save drkane/9e3067a82d108b8cfd349d11d4ce25e9 to your computer and use it in GitHub Desktop.
Bins used for age, income and award amount for charity/grants data
# Bins used for numeric fields
AMOUNT_BINS = [0, 500, 1000, 2000, 5000, 10000, 100000, 1000000, float("inf")]
AMOUNT_BIN_LABELS = ["Under £500", "£500 - £1k", "£1k - £2k", "£2k - £5k", "£5k - £10k",
"£10k - £100k", "£100k - £1m", "Over £1m"]
INCOME_BINS = [-1, 10000, 100000, 250000, 500000, 1000000, 10000000, float("inf")]
INCOME_BIN_LABELS = ["Under £10k", "£10k - £100k", "£100k - £250k",
"£250k - £500k", "£500k - £1m", "£1m - £10m", "Over £10m"]
AGE_BINS = pd.to_timedelta(
[x * 365 for x in [-1, 1, 2, 5, 10, 25, 200]], unit="D")
AGE_BIN_LABELS = ["Under 1 year", "1-2 years", "2-5 years",
"5-10 years", "10-25 years", "Over 25 years"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment