python replace 0 with mean in a dataframe code example
Example 1: replace column values pandas
df['column'] = df['column'].str.replace(',','-')
df
Example 2: how to replace zero value in python dataframe
nonzero_mean = df[ df.col != 0 ].mean()
df['column'] = df['column'].str.replace(',','-')
df
nonzero_mean = df[ df.col != 0 ].mean()