Answers for "creating new column with dictionary"

0

creating new column with dictionary

In [248]:
dict_ = {112: 'en', 113: 'es', 114: 'es', 111: 'en'}
df['D'] = df['U'].map(dict_)
df

Out[248]:
     U   L   D
0  111  en  en
1  112  en  en
2  112  es  en
3  113  es  es
4  113  ja  es
5  113  zh  es
6  114  es  es
Posted by: Guest on September-23-2021

Code answers related to "creating new column with dictionary"

Python Answers by Framework

Browse Popular Code Answers by Language