replace a value with nan if another column code example
Example 1: replace "-" for nan in dataframe
df.replace(np.nan,0)
Example 2: replace all nan values in dataframe
# Replacing all nan values with 0 in Dataframe
df = df.fillna(0)
df.replace(np.nan,0)
# Replacing all nan values with 0 in Dataframe
df = df.fillna(0)