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?


If you have multiple values to sort on I suggest using
pandas, building apandas.DataFrameand 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.