Steven D'Aprano <steve+pyt...@pearwood.info> added the comment:
Thank you for your comments, but accepting non-floats like Decimal and Fraction (and int, of course!) is a hard requirement for the statistics module. fmean will naturally convert any data to float for speed, but the other means will attempt to keep the original data type if possible, so that the mean() of Decimals will be a Decimal, the mean of Fractions will be a Fraction, etc. The median_low and median_high functions don't require numbers at all, the data points just need to be ordinal data and support sorting. The mode function doesn't even require ordinal data, it can work with nominal data. That is part of the definition of median and mode, and will not change. http://intellspot.com/nominal-vs-ordinal-data/ So long as Python support IEEE-754 floating point arithmetic, which is the most common standard for floating point, there will be NANs and INFs. We should not reject them unnecessarily. You can always pre-filter your data before passing it the statistics module. Why do you object to float INF? ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue38382> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com