pandas: replace string with another string
<p>I have the following data frame</p>

<pre><code>    prod_type
0   responsive
1   responsive
2   respon
3   r
4   respon
5   r
6   responsive
</code></pre>

<p>I would like to replace <code>respon</code> and <code>r</code> with <code>responsive</code>, so the final data frame is</p>

<pre><code>    prod_type
0   responsive
1   responsive
2   responsive
3   responsive
4   responsive
5   responsive
6   responsive
</code></pre>

<p>I tried the following but it did not work:</p>

<pre><code>df['prod_type'] = df['prod_type'].replace({'respon' : 'responsvie'}, regex=True)
df['prod_type'] = df['prod_type'].replace({'r' : 'responsive'}, regex=True)
</code></pre>

<p>Other solution in case all items from <code>df['prod_type']</code> will be the same:</p>

<pre><code>df['prod_type'] = ['responsive' for item in df['prod_type']]
In[0]: df
Out[0]:
prod_type
0  responsive
1  responsive
2  responsive
3  responsive
4  responsive
5  responsive
6  responsive
</code></pre>

python string python-2.7 pandas replace