Steven D'Aprano <steve+pyt...@pearwood.info> added the comment: On Fri, Mar 16, 2018 at 02:32:36PM +0000, Mark Dickinson wrote: > For what it's worth, NumPy gives a result of NaN for the median of an array > that contains NaNs:
By default, R gives the median of a list containing either NaN or NA ("not available", intended as a missing value) as NA: > median(c(1, 2, 3, 4, NA)) [1] NA > median(c(1, 2, 3, 4, NaN)) [1] NA but you can ignore them too: > median(c(1, 2, 3, 4, NA), na.rm=TRUE) [1] 2.5 > median(c(1, 2, 3, 4, NaN), na.rm=TRUE) [1] 2.5 ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue33084> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com