I am trying to find the median of a table without it considering the NaN values in the table. Is there a simple way to have the function ignore those values?
INPUT
data_source = (r"C:\Users\mburen\Desktop\TestPython2.xlsx")
bk = pd.read_excel(data_source)
print("Here is what the original excel table looks like. The bk table.")
print (bk)
print ()
#now for finding the median
x=np.median(bk)
print (x)
OUTPUT
The median is the calculated central number of all the values. The median is: nan
CodePudding user response:
Did you see np.nanmedian introduced in numpy 1.9? nanmedian