Skip NaN values in axis min/max calculations.

Resolves #489.