title: Concatenate Text on Pandas Dataframe in Python
body: <p>I'm trying to concatenate text along a row, then group by the ID</p>
  
  <p>I have a dataset that looks like this:</p>
  
  <pre><code>data=pd.DataFrame(data={'ID':['1','1','2','2','2','3','3','3','3'],
                      'Text1':['Apple','','','Laptop','','Pens','','Ruler',''],
                      'Text2': ['Bananas','Grape','Mouse','','DVD Player','','Pencils','',''],
                      'Text3':['Cherry','','','Headphones','','','','','Eraser'],
                      'Text4':['Mango','Strawberries','','','Cell phone','','Sticky Notes','','']
                     })
  
  data =data.set_index('ID')
  
  ID  Text1   Text2      Text3      Text4
  1   Apple   Bananas    Cherry     Mango
  1           Grape                 Strawberries
  2           Mouse       
  2   Laptop             Headphones   
  2           DVD-Player            Cell-phone
  3   Pens            
  3           Pencils               Sticky Notes
  3   Ruler           
  3           Eraser  
  </code></pre>
  
  <p>My desired operations:</p>
  
  <ol>
  <li><p>Concatenate row-wise first</p></li>
  <li><p>Group by each ID to get a group of words separated by a delimiter</p></li>
  </ol>
  
  <p><a href="https://i.stack.imgur.com/mQttp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mQttp.png" alt="Desired Data Frame"></a></p>
  
  <p>Any ideas on how to achieve this output?</p>