Python: Pandas: two columns with same values, alphabetically sorted and stored
<p><strong>Problem</strong><br>
"The df has two columns but sometimes filled with the same values. We need to re-save them into two new columns but in alphabetical order"<br></p>

<p><strong>Context</strong><br>
We have a pandas df like this:</p>

<pre><code>df = pd.DataFrame([{"name_A": "john", "name_B": "mac"}, {"name_A": "mac", "name_B": "john"}])
</code></pre>

<p>Like this:</p>

<pre><code>name_A | name_B
john   |  mac 
mac    |  john 
Trump  |  Clinton
</code></pre>

<p><br><strong>Desired Output</strong><br></p>

<pre><code>name_A | name_B   | restated_A  | restated_B
john   |  mac     |  john       |  mac
mac    |  john    |  john       |  mac
trump  |  clinton |  clinton    | trump   
</code></pre>

<p>In words, we wish to have the columns' values <code>name_A</code>  and <code>name_B</code> to be alphabetically sorted in <code>restated_A</code>  AND <code>restated_B</code></p>

<p><strong>Tried so far</strong><br>
bunch of lambdas but couldn't get it to work<br></p>

<p><strong>Specifications</strong><br>
Python: 3.5.2<br>
Pandas: 0.18.1 </p>