Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #creating #column #dictionary
ADD COMMENT
Topic
Name
2+1 =