In [1]:
import numpy as np
import pandas as pd
from pandas import DataFrame, Series

In [3]:
ser1 = Series([1,2,3,4,1,2,3,4])

In [4]:
ser1.replace(1, np.nan)


Out[4]:
0    NaN
1    2.0
2    3.0
3    4.0
4    NaN
5    2.0
6    3.0
7    4.0
dtype: float64

In [5]:
ser1.replace([1,4], [100, 400])


Out[5]:
0    100
1      2
2      3
3    400
4    100
5      2
6      3
7    400
dtype: int64

In [6]:
ser1.replace({4: 400})


Out[6]:
0      1
1      2
2      3
3    400
4      1
5      2
6      3
7    400
dtype: int64

In [ ]: