python - Finding minimum and maximum value for each row, excluding NaN values -


i have code plots multiple wind speed values during day @ 50 different altitudes. i'm trying program gives me minimum , maximum values @ each different altitude can see minimum , maximum winds experienced during day.

i've tried np.min(wind_speed, axis=0) giving me nan. have line reads bad values of wind speed nan. how able avoid getting nan value , getting actual minimum , maximum value occurring during day?

to ignore nan values use nanmin , analagous nanmax:

npnanmin(wind_speed, axis=0) npnanmax(wind_speed, axis=0) 

this ignore nan values desired

example:

in [93]: wind_speed = np.array([234,np.nan,343, np.nan]) wind_speed  out[93]: array([ 234.,   nan,  343.,   nan])  in [94]: print(np.nanmin(wind_speed, axis=0), np.nanmax(wind_speed, axis=0)) 234.0 343.0 

Comments