Add prefix to specific columns of Dataframe
<p>I've a DataFrame like that :</p>

<pre><code>col1   col2   col3   col4   col5   col6   col7   col8
0      5345   rrf    rrf    rrf    rrf    rrf    rrf
1      2527   erfr   erfr   erfr   erfr   erfr   erfr
2      2727   f      f      f      f      f      f
</code></pre>

<p>I would like to rename all columns but not <strong>col1</strong> and <strong>col2</strong>.</p>

<p>So I tried to make a loop</p>

<pre><code>print(df.columns)
    for col in df.columns:
        if col != 'col1' and col != 'col2':
            col.rename = str(col) + '_x'
</code></pre>

<p>But it's not very efficient...it doesn't work !</p>