df
df.replace({"A":1,"B":2}, 999)
df.replace({"A":[1,2],"B":[2,3]}, 999)
df.replace({'A': r'^(1)$', 'B': r'^(2)$'}, r'\1_new', regex=True)