title: Python 3 Pandas Combining or merging columns with similar data
body: <p>I have a dataframe that I am trying to update the sex column with the Gender column</p>
  
  <pre><code>import pandas as pd
  import numpy as np
  
  df=pd.DataFrame({'Users': [ 'Al Gore', 'Ned Flonders', 'Kim jong un', 'Al Sharpton', 'Michele', 'Richard Johnson', 'Taylor Swift', 'Alf pig', 'Dick Johnson', 'Dana Jovy'],
                   'Gender': [np.nan,'Male','Male','Male',np.nan,np.nan, 'Female',np.nan,'Male','Female'],
                   'Sex': ['M',np.nan,np.nan,'M','F',np.nan, 'F',np.nan,np.nan,'F']})
  </code></pre>
  
  <p>Output</p>
  
  <pre><code>&gt;&gt;&gt; 
     Gender  Sex            Users
  0     NaN    M          Al Gore
  1    Male  NaN     Ned Flonders
  2    Male  NaN      Kim jong un
  3    Male    M      Al Sharpton
  4     NaN    F          Michele
  5     NaN  NaN  Richard Johnson
  6  Female    F     Taylor Swift
  7     NaN  NaN          Alf pig
  8    Male  NaN     Dick Johnson
  9  Female    F        Dana Jovy
  
  [10 rows x 3 columns]
  </code></pre>
  
  <p>So if it is male in the "Gender" Column it would show as M in the sex column.</p>
  
  <p>So far here is what I attempted:</p>
  
  <pre><code>df['Sex2']=(df.Gender.isin(['Male']).map({True:'M',False:''}) +
                  df.Sex.isin(['M']).map({True:'M',False:''}) +
                  df.Sex.isin(['F']).map({True:'F',False:''})+
                  df.Gender.isin(['Female']).map({True:'F',False:''}))
  
  print(df)
  </code></pre>
  
  <p>output</p>
  
  <pre><code>[10 rows x 3 columns]
     Gender  Sex            Users Sex2
  0     NaN    M          Al Gore    M
  1    Male  NaN     Ned Flonders    M
  2    Male  NaN      Kim jong un    M
  3    Male    M      Al Sharpton   MM
  4     NaN    F          Michele    F
  5     NaN  NaN  Richard Johnson     
  6  Female    F     Taylor Swift   FF
  7     NaN  NaN          Alf pig     
  8    Male  NaN     Dick Johnson    M
  9  Female    F        Dana Jovy   FF
  
  [10 rows x 4 columns]
  </code></pre>
  
  <p>I almost got it but this might not be too efficient</p>
  
  <p>Here is what I would like as the output</p>
  
  <pre><code>&gt;&gt;&gt; 
     Gender  Sex            Users
  0     NaN    M          Al Gore
  1    Male    M     Ned Flonders
  2    Male    M      Kim jong un
  3    Male    M      Al Sharpton
  4     NaN    F          Michele
  5     NaN  NaN  Richard Johnson
  6  Female    F     Taylor Swift
  7     NaN  NaN          Alf pig
  8    Male    M     Dick Johnson
  9  Female    F        Dana Jovy
  
  [10 rows x 3 columns]
  </code></pre>
  
  <p>Is it possible to use some merge or update function to do this?</p>