numpy/numpy — pull request #3866 by charris (2013-10-04 20:15:23+00:00)
Title: Refactor 1.9 nanfunctions

Deal with subclasses of ndarray, like pandas.Series and matrix.

Subclasses may not define the new keyword keepdims or deal
gracefully with ufuncs in all their forms. This is solved by
throwing the problem onto the np.sum, np.any, etc. functions
that have ugly hacks to deal with the problem.

Settle handling of all-nan slices.

nanmax, nanmin -- Raise warning, return NaN for slice.
nanargmax, nanargmin -- Raise ValueError.
nansum -- Return 0 for slice.
nanmean, nanvar, nanstd -- Raise warning, return NaN for slice.

Make NaN functions work for scalar arguments.

This may seem silly, but it removes a check for special cases.

Update tests

Deal with new all-nan handling.
Test with matrix class as example of subclass without keepdims.
Test with scalar arguments.

Fix nanvar issue reported in #3860.

Closes #3860 #3850