Replace values of two columns in pandas
<p>What is the fastest way to replace values of two columns in pandas? Let's say given is:</p>

<pre><code>A B
0 2
1 3
</code></pre>

<p>and we want to get:</p>

<pre><code>A B
2 0
3 1
</code></pre>

<p>This code flips the values between the columns:</p>

<pre><code>&gt;&gt;&gt; df_name[['A', 'B']] = df_name[['B', 'A']]

&gt;&gt;&gt; print(df_name)
A  B
2  0
3  1
</code></pre>

python pandas