Hello,
There is the following snippet of code
c.most_common()[:-n:-1] # n least common elements
Actually this expression returns not n least common elements, but rather n - 1, beacuse second boundary is not included (as usual with slices).
You probably meant c.most_common()[-n:] or c.most_common()[:-n-1:-1] if reverse ordering is nesessary.
--
Best regards
Mikhail Golubev