title: How to separate string into multiple rows in Pandas
body: <p>we have the following data</p>
  
  <pre><code>  Name  genres
  
    A     Action|Adventure|Science Fiction|Thriller 
    B     Action|Adventure|Science Fiction|Thriller 
    C     Adventure|Science Fiction|Thriller
  </code></pre>
  
  <p>I want the data such that my data frame is</p>
  
  <pre><code>  Name  genres
    A     Action
    A     Adventure
    A     Science Fiction
    A     Thriller
    B     Action
    B     Adventure
    B     Science Fiction
    B     Thriller
    C     Adventure
    C     Science Fiction
    C     Thriller
  </code></pre>
  
  <p>here is my code </p>
  
  <pre><code>gen = df1[df1['genres'].str.contains('|')]
  gen1 = gen.copy()
  gen2 = gen.copy()
  gen3 = gen.copy()
  gen4 = gen.copy()
  gen1['genres'] = gen1['genres'].apply(lambda x: x.split("|")[0])
  gen2['genres'] = gen2['genres'].apply(lambda x: x.split("|")[1])
  gen3['genres'] = gen3['genres'].apply(lambda x: x.split("|")[2])   
  gen4['genres'] = gen4['genres'].apply(lambda x: x.split("|")[3])
  </code></pre>
  
  <p>I am getting the error </p>
  
  <blockquote>
    <p>IndexError: list index out of range</p>
  </blockquote>