How do I find mean/average of a column in a Pandas DataFrame, which also includes np.NaN (NaN = Not a number) value?
Asked
Active
Viewed 22 times
0
-
2Use `df['col'].mean()`, pandas by default exclude `NaN` – jezrael Mar 10 '21 at 05:34
-
`df[column_name].mean()` should do the work – Prayson W. Daniel Mar 10 '21 at 05:35
-
But if need include NaN - it means if at least one `NaN` ouput is `NaN` use `df['col'].mean(skipna=False)` – jezrael Mar 10 '21 at 05:35