ENH: use numpys nanmedian if available

numpys version is several hundred times faster for repeated small
medians along a large axis. E.g. (10000, 100) -> (10000,)