d = {'apple': 1, 'peach': 6, 'watermelon': 4, 'grapes': 5, 'orange': 2,'banana': 3} df["fruit_tag"] = df["fruit_tag"].map(d) print (df) fruit_tag 0 1.0 1 2.0 2 3.0 3 4.0 4 NaN 5 NaN