In [2]:
df
Out[2]:
A B C
0 0 0 a
1 0 1 b
2 1 2 c
3 1 3 d
4 2 4 e
5 2 5 f

Replace a value in all columns.

In [3]:
df.replace(1, 100)
Out[3]:
A B C
0 0 0 a
1 0 100 b
2 100 2 c
3 100 3 d
4 2 4 e
5 2 5 f

Replace multiple values in all columns.

In [4]:
df.replace([1, 2], 999)
Out[4]:
A B C
0 0 0 a
1 0 999 b
2 999 999 c
3 999 3 d
4 999 4 e
5 999 5 f

Replace values using regular expression.

In [5]:
df = df.astype('str')
df.replace(r'^([0-9])$', r'new_\1', regex=True)
Out[5]:
A B C
0 new_0 new_0 a
1 new_0 new_1 b
2 new_1 new_2 c
3 new_1 new_3 d
4 new_2 new_4 e
5 new_2 new_5 f