title: How to conditionally separate a cell value and add to a column using pandas
body: <p>For example</p>
  
  <p><strong>testing.csv:</strong></p>
  
  <pre><code>First Name    Last Name  Profile URL
  Ashleigh      Phelps     https://www.linkedin.com/in/ashleighephelps
  Jonathan                 https://www.linkedin.com/in/jonathantsegal
  Camilla Innes            https://www.linkedin.com/in/camilla-innes-61213628  
  Rachel                   https://www.linkedin.com/in/rachel-hudesman-335b8120
  Michael                  https://www.linkedin.com/in/mikeitalia
  Antonio                  https://www.linkedin.com/in/antoniomolinelli
  Lauren        Zsigray    https://www.linkedin.com/in/lauren-zsigray-13b5aa25
  </code></pre>
  
  <p>The code I have used will only separate which has a hyphen but how to get the last name which is with the first name?</p>
  
  <pre><code>df = pd.read_csv("testing.csv", sep=',', encoding="utf-8")
  df = df[df['Last Name'].isnull()]
  p = df.pop('Profile URL')
  tmp_df = p.str.split('/')
  df['Last Name'] = tmp_df.str[-1]
  tmp1_df = df.pop('Last Name').str.split('-')
  df['Last Name'] = tmp1_df.str[1:-1].str.join(sep='-')
  df = pd.concat([df, p], axis=1)
  print (df)
  </code></pre>
  
  <p>Which gives this output:</p>
  
  <pre><code>First Name  Last Name       Profile URL
  Ashleigh    Phelps          https://www.linkedin.com/in/ashleighephelps
  Jonathan                    https://www.linkedin.com/in/jonathantsegal
  Camilla     Innes           https://www.linkedin.com/in/camilla-innes-61213628
  Rachel      hudesman        https://www.linkedin.com/in/rachel-hudesman-335b8120
  Michael                     https://www.linkedin.com/in/mikeitalia
  Antonio                     https://www.linkedin.com/in/antoniomolinelli
  Lauren      Zsigray         https://www.linkedin.com/in/lauren-zsigray-13b5aa25
  </code></pre>
  
  <p><strong>Expected output:</strong>  </p>
  
  <pre><code>First Name  Last Name       Profile URL
  Ashleigh    Phelps          https://www.linkedin.com/in/ashleighephelps
  Jonathan    tsegal          https://www.linkedin.com/in/jonathantsegal
  Camilla     Innes           https://www.linkedin.com/in/camilla-innes-13628
  Rachel      hudesman        https://www.linkedin.com/in/rachel-hudesman-33
  Michael                     https://www.linkedin.com/in/mikeitalia
  Antonio     molinelli       https://www.linkedin.com/in/antoniomolinelli
  Lauren      Zsigray         https://www.linkedin.com/in/lauren-zsigray-13b5a  
  </code></pre>
  
  <p>What should be used to get the output in this format</p>