mapping the names of groups in a data-frame in pandas
<p>I have a dataframe </p>

<pre><code>df=pd.DataFrame({'name':['a','b','c','a','b','a'],'value':\
   [1,2,3,4,5,6],'value2':[7,8,9,10,11,12]})
</code></pre>

<p>I want to map the columns name to a new list for example:['G','H','F'], so I would get:</p>

<pre><code>df=pd.DataFrame({'name':['G','H','F','G','H','G'],'value':\
   [1,2,3,4,5,6],'value2':[7,8,9,10,11,12]})
</code></pre>

<p>Use the built-in <code>pandas</code> method:</p>

<pre><code>&gt;&gt;&gt; df=pd.DataFrame({'name':['a','b','c','a','b','a'],'value':\
...    [1,2,3,4,5,6],'value2':[7,8,9,10,11,12]})
&gt;&gt;&gt; df
  name  value  value2
0    a      1       7
1    b      2       8
2    c      3       9
3    a      4      10
4    b      5      11
5    a      6      12
&gt;&gt;&gt; df.name.map({'a':'G','b':'H','c':'F'})
0    G
1    H
2    F
3    G
4    H
5    G
Name: name, dtype: object
&gt;&gt;&gt; df['name'] = df.name.map({'a':'G','b':'H','c':'F'})
&gt;&gt;&gt; df
  name  value  value2
0    G      1       7
1    H      2       8
2    F      3       9
3    G      4      10
4    H      5      11
5    G      6      12
&gt;&gt;&gt; 
</code></pre>

python pandas