Skip to content

Instantly share code, notes, and snippets.

@onurmatik
Last active August 22, 2019 09:48
Show Gist options
  • Save onurmatik/d4475e03685d03302c3a3ba4cf369abd to your computer and use it in GitHub Desktop.
Save onurmatik/d4475e03685d03302c3a3ba4cf369abd to your computer and use it in GitHub Desktop.
# sort the number of retweets from the highest to the lowest
rt_counts.sort(reverse=True)
# the max number of tweets that has at least been retweeted that number of times
r_index = max(
[min(i + 1, rt_count) for i, rt_count in enumerate(rt_counts)]
) if rt_counts else 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment