BUG: Refactor nanfunctions to behave as agreed on for 1.9.

    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
BUG: Make ndarray.{var, std} work for scalars.
Merge pull request #3866 from charris/refactor-1.9-nanfunctions

Refactor 1.9 nanfunctions