Add nanmean, nanvar, and nanstd functions.

The old nan functions and their tests are consolidated with the new functions
and tests in numpy/lib/nanfunctions.py and numpy/lib/tests/test_nanfunctions.py

Some refactoring is also done for the mean, var and std methods in
numpy/core/_methods.py and more extensive tests are added. In particular,
the type of scalar returns is now the same as for vector returns and the number of
degrees of freedom are checked so that negative variances are not returned. Warnings
are raised in the non-positive degrees of freedom case or when taking the mean of empty
slices.

Some refactoring of the old nan functions has also been done. The following summarizes
the state of the nan functions after this PR.

nanmax, nanmin
--------------
Add out and keepdims keywords.

nanargmin, nanargmax
--------------------
A NanWarning is raised if an all NaN slice detected. For all such
slices np.iingo(np.intp).min is returned as the index value.

nansum
------
The keywords dtype, out, and keepdims are added.

A FutureWarning is raised, as in the future the mean of an empty
slice after NaN replacement will be 0 instead of the current NaN.

nanmean, nanvar, nanstd
-----------------------
For all, if the input array is of inexact type then the dtype and out
parameters must be of inexact type if specified.  That insures that
NaNs can be returned when appropriate.

The nanmean function detects empty slices after NaN replacement
and raises a NanWarning. NaN is returned as the value for all such
slices.

The nanmean and nanstd functions detect degrees of freedom <= 0 after
NaN replacement and raise a NanWarning. NaN is returned as the value
for all such slices.