Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to rename values in a column python

In [11]: df['n'].replace({'a': 'x', 'b': 'y', 'c': 'w', 'd': 'z'})
Out[11]: 
0    z
1    x
2    y
3    w
4    w
5    x
6    z
7    y
Name: n, dtype: object

In [12]: df['n'] = df['n'].replace({'a': 'x', 'b': 'y', 'c': 'w', 'd': 'z'})
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #rename #values #column #python
ADD COMMENT
Topic
Name
7+4 =