To find the most common, I know I can use something like this:
most_common = collections.Counter(list).most_common(to_find)
However, I can’t seem to find anything comparable, for finding the least common element.
Could I please get recommendations on how to do.
Borrowing the source of
collections.Counter.most_commonand inverting as appropriate: