df.column.fillna(0,inplace=True)
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()