6
How to sort a list of communities by engagement?
(programming.dev)
Welcome to the Python community on the programming.dev Lemmy instance!
Past
November 2023
October 2023
July 2023
August 2023
September 2023
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.