working out average value values in columns pandas excluding values code example
Example 1: pandas find median of non zero values in a column
# find the median of non zero values from the column 'minSalaryAnnual
medianMinPA = (df['minSalaryAnnual'].loc[df['minSalaryAnnual'] != 0]).median()
Example 2: Row wise mean pandas
df['mean'] = df.iloc[:, 0:4].mean(axis=1)