df
df['A'] = df['A'].replace(1, 100)
df
df = pd.DataFrame(default_dict)
df.replace({"A":1,"B":1}, 100)
df.replace(1, 100)
0 is not replace in column A as there is not a valid value above the value.
df.replace([0, 2], method='ffill')
2 is not replace in column A as there is not a valid value below the value.
df.replace([0, 2], method='bfill')