6
submitted 1 week ago* (last edited 1 week ago) by CoderSupreme@programming.dev to c/python@programming.dev

I have a list of communities, each with total votes, upvote percentage, and the community name. I want to sort the list by 'engagement,' which would be some combination of total votes and upvote percentage. What is the best way to do this? What would be the best measure of 'engagement' with each community given this data?

you are viewing a single comment's thread
view the rest of the comments
[-] gigachad@piefed.social 1 points 1 week ago

If you have multiple values to sort on I suggest using pandas, building a pandas.DataFrame and sort it using the .sort_values() method, which allows you to provide multiple sorting keys. Your data sounds to complex for lists, it is easy to lose the overview. You could work with dictionaries, but then you need to write some ugly loops or comprehension.

this post was submitted on 17 Oct 2025
6 points (100.0% liked)

Python

7527 readers
5 users here now

Welcome to the Python community on the programming.dev Lemmy instance!

📅 Events

PastNovember 2023

October 2023

July 2023

August 2023

September 2023

🐍 Python project:
💓 Python Community:
✨ Python Ecosystem:
🌌 Fediverse
Communities
Projects
Feeds

founded 2 years ago
MODERATORS