def nan_to_zeros(df, col):
new_col = f"nanreplace{col}"
df[new_col] = df[col].fillna('~')
return df
When running this function I get the
SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame.
warning and from what I can gather I am not using a chained assignment and adding inplace=True
does nothing to silence the warning.
Any direction appreciated. Thanks!