This question already has an answer here:
Closed 3 years ago.
import numpy as np
print max([np.nan, 1, 2, 3, 4])
print max([1, 2, 3, 4, np.nan])
print max([1, 2, 3, np.nan, 4])
the first will print nan as list's max value
the second will print 4 as list's max value
the third will print 4 as list's max value
Is there a solution for this problem? Make all math function just ignore nan?