title: apply function in pandas to create two columns
body: <p>I have a Pandas DataFrame called <code>ebola</code> as seen below. <code>variable</code> column has two pieces of information <code>status</code> whether it is <em>Cases</em> or <em>Deaths</em> and <code>country</code> which consists of country names. I try to create two new columns <code>status</code> and <code>country</code> out of that <code>variable</code> column by using <code>.apply()</code> function. However, since there are two values I am trying to extract, it does not work.</p>
  
  <p><a href="https://i.stack.imgur.com/HTCgK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HTCgK.png" alt="ebola dataframe"></a></p>
  
  <pre><code># let's create a splitter function
  def splitter(column):
      status, country = column.split("_")
      return status, country
  
  # apply this function to that column and assign to two new columns
  ebola[['status', 'country']] = ebola['variable'].apply(splitter)
  </code></pre>
  
  <p>The error I get is</p>
  
  <pre><code>ValueError: Must have equal len keys and value when setting with an iterable
  </code></pre>
  
  <p><strong>I want my output to be like this</strong></p>
  
  <p><a href="https://i.stack.imgur.com/VT5xJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VT5xJ.png" alt="enter image description here"></a></p>