title: Problems while spliting pandas dataframe row?
body: <p>I have the following pandas dataframe:</p>
  
  <p>In: </p>
  
  <pre><code>df
  </code></pre>
  
  <p>out:</p>
  
  <pre><code>         A    B        C                                             D
  0  0938320  usa   amazon              orange: $ 8.00| pineapple: $2.00
  1  0938320  usa  alibaba                  orange: $ 8.00| apple: $2.00
  2  0938320  usa     ebay  mint: $ 8.00| watermelon: $2.00| mint: $2.00
  ...
  n  0938320  usa   amazon                  pear: $ 8.00| bannana: $2.00
  </code></pre>
  
  <p>I would like to split by <code>|</code> and stack it into (*):</p>
  
  <pre><code>         A    B        C                  D
  0  0938320  usa   amazon     orange: $ 8.00
  1  0938320  usa   amazon   pineapple: $2.00
  2  0938320  usa  alibaba     orange: $ 8.00
  3  0938320  usa  alibaba       apple: $2.00
  4  0938320  usa      bay       mint: $ 8.00
  5  0938320  usa     ebay  watermelon: $2.00
  6  0938320  usa     ebay        mint: $2.00
  7  0938320  usa   amazon       pear: $ 8.00
  ...
  8  0938320  usa   amazon     bannana: $2.00
  </code></pre>
  
  <p>So, I tried the following:</p>
  
  <p>In:</p>
  
  <pre><code>s = df2.D.str.split("|").apply(pd.Series, 1).stack()
  s.index = s.index.droplevel(-1)
  del df2['D']
  df.join(s)
  </code></pre>
  
  <p>out:</p>
  
  <pre><code>ValueError: Other Series must have a name
  </code></pre>
  
  <p>And:</p>
  
  <pre><code>b = pd.DataFrame(df2.D.str.split('|').tolist(), index=df2['A','B','C']).stack()
  b = b.reset_index()[[0, 'D']] 
  b.columns = ['A','B','C']
  b
  </code></pre>
  
  <p>However, is not working. How can I modify the last approach in order to get (*)?. I guess that my main problem is that I do not know how to take all the columns in <code>index=df2['A','B','C']).stack()</code>.</p>