create new column using dictionary padnas code example
Example: create new column using dictionary padnas
U
111
112
112
d = {112: 'a', 111: 'b'}
df['B'] = df['A'].map(d)
df
Out[248]:
A B
0 111 a
1 112 b
U
111
112
112
d = {112: 'a', 111: 'b'}
df['B'] = df['A'].map(d)
df
Out[248]:
A B
0 111 a
1 112 b