Skip to content

Instantly share code, notes, and snippets.

@amirziai
Created September 25, 2022 23:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amirziai/dfff50d8c06226ac744089851d72f2b2 to your computer and use it in GitHub Desktop.
Save amirziai/dfff50d8c06226ac744089851d72f2b2 to your computer and use it in GitHub Desktop.
def alloc(
ch: ConsistentHashingWithTokens,
) -> pd.Series:
return pd.Series(
ch.key_lookup(url)
for url in urls
).value_counts(normalize=True)
ch = ConsistentHashingWithTokens({'a': 100, 'b': 400, 'c': 500})
alloc(ch=ch)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment