Maybe we can just change the function signature: statistics.median(it, do_wrong_ass_thing_with_nans=False)
:-) But yes, the problem is really with sorted(). However, the implementation of statistics.median() doesn't HAVE TO use sorted(), that's just one convenient way to do it. There IS NO right answer for `sorted([nan, 1, 2, 3])`. However, there is a very plausibly right answer for `statistics.median([nan, 1, 2, 3])` ... or rather, both 'nan' and '2' are plausible (one approach is what Numpy does, the other is what Pandas does). -- Keeping medicines from the bloodstreams of the sick; food from the bellies of the hungry; books from the hands of the uneducated; technology from the underdeveloped; and putting advocates of freedom in prisons. Intellectual property is to the 21st century what the slave trade was to the 16th.
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/524SWHDA3HVPDIQ6F6S3OMFGFXPCVGLO/ Code of Conduct: http://python.org/psf/codeofconduct/