Bug report
Bug description:
statistics.mode uses collections.Counter so only works for data that are hashable
from statistics import mode
mode([{1,2},{1,2},{3}])
raisesTypeError: unhashable type: 'set'
Same issue with multimode.
This limitation is not mentioned in the docs or the docstring.
Potential solutions:
- Add the fact that the function doesn't work on unhashable types to the documentation, and raise a
StatisticsError if the user provides unhashable data
- Come up with a separate algorithm for handling unhashable data. Would be interested to hear ideas on the appropriate algorithm.
CPython versions tested on:
CPython main branch
Operating systems tested on:
Windows
Linked PRs
Bug report
Bug description:
statistics.modeusescollections.Counterso only works for data that are hashableraises
TypeError: unhashable type: 'set'Same issue with
multimode.This limitation is not mentioned in the docs or the docstring.
Potential solutions:
StatisticsErrorif the user provides unhashable dataCPython versions tested on:
CPython main branch
Operating systems tested on:
Windows
Linked PRs