【original data】 hoge = pd.Series (["3rd", "1st", "5th", "5th", "2nd", "4th"])
[Conversion list] name_lis = {"first time": "01.first", "Second time": "02.second", "Third time": "03.third", "4th": "04.fourth", "5th time": "05.fifth" }
Surround the Series with a map (Thanks to @nkay!)
hoge.map(name_lis)
Enclose Series in a dictionary
hoge.apply(lambda x: name_lis[x])
0 03.third 1 01.first 2 05.fifth 3 05.fifth 4 02.second 5 04.fourth dtype: object
Recommended Posts