[issue33084] statistics module: NaN handling in median, median_high an median_low

2021-08-27 Thread Steven D'Aprano
Steven D'Aprano added the comment: See thread on Python-Ideas. https://mail.python.org/archives/list/python-id...@python.org/thread/EDRF2NR4UOYMSKE64KDI2SWUMKPAJ3YM/ -- ___ Python tracker

[issue33084] statistics module: NaN handling in median, median_high an median_low

2021-08-20 Thread Raymond Hettinger
Raymond Hettinger added the comment: [Steven] > Thoughts? 1) Document that results are undefined if a NaN is present in the data. 2) Add function to strip NaNs from the data: def remove_nans(iterable): "Remove float('NaN') and other objects not equal to themselves"

[issue33084] statistics module: NaN handling in median, median_high an median_low

2021-08-20 Thread Irit Katriel
Irit Katriel added the comment: Reproduced in 3.11: >>> import numpy as np >>> import statistics as stats >>> data = [75, 90,85, 92, 95, 80, np.nan] >>> stats.median(data) 90 >>> stats.median_low(data) 90 >>> stats.median_high(data) 90 -- nosy: +iritkatriel title: Computing median,