ENH: Added proper handling of nans for numpy.lib.function_base.median
to close issue #586.

Also added unit test.
ENH: Updated error checking of axis in median. Negative axis is now dealt with properly.
ENH: Now throwing ValueError instead of IndexError. Also saving original axis to make the error message less confusing.
MAINT: Rebasing