Les pandas remplacent les nuls par des zéros
df['col1'] = df['col1'].fillna(0)
Worrisome Wallaby
df['col1'] = df['col1'].fillna(0)
# in column_B of dataframe, replace zero with blanks
df['column_B'].replace(['0', '0.0'], '', inplace=True)
nonzero_mean = df[ df.col != 0 ].mean()