Mean calculation in pandas, excluding zeros
Is there a direct way to calculate the mean of a dataframe column in pandas, but not taking into account data that has zero as a value? Like a parameter inside the .mean() function? I was currently doing it like this: x = df[df[A]!=0] x.mean()
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.