python - pandas mean function returning NaN -
i know may newbie question, please forgive me, have not found answer seems make sense to/help me. importing data .csv file , need slice out particular part. have done , when print data frame , values need present.
df = pd.read_csv('c:/users/owner/desktop/df.csv') dfr = df[44:58] #rows need dfrc = dfr[['1','2','3','4','5']] #columns need dfrc.mean(axis=1 skipna=true) #there nans present in last index
what returned
44 nan ... 57 nan dtype: float64
i not sure why is, need numerical value mean of index/row. hoping on forum able help. thank you.
are sure data numeric (int or float)? maybe should try cast columns before, , see if error raised.
dfrc = dfrc.astype(float)
Comments
Post a Comment