Is there a direct way to calculate the average value of a dataframe column in pandas, but not taking into account data that has zero as the value? How is the parameter inside the .mean () function? Currently, this is done as follows:
x = df[df[A]!=0]
x.mean()
source
share