title: How do I Join different lines of text in Pandas Python?
body: <p>I have a Dataframe like below:</p>
  
  <pre><code>Date 1-Jan 2-Jan 3-Jan 4-Jan
  Duty
  1    Bob   NaN   Bob   NaN
  2    NaN   NaN   Bob   Bob
  3    NaN   NaN   Bob   Bob
  </code></pre>
  
  <p>What I want to achieve is adding a last line that with each date, if there are <code>Bob</code> in any <code>Duty</code>,the value will be "Bob", like below:</p>
  
  <pre><code>Date 1-Jan 2-Jan 3-Jan 4-Jan
  Duty
  1    Bob   NaN   Bob   NaN
  2    NaN   NaN   Bob   Bob
  3    NaN   NaN   Bob   Bob
  sum  Bob   NaN   Bob   Bob
  </code></pre>
  
  <p>What I tried is to use <code>pd.apply</code> like below:</p>
  
  <p><code>df.loc['sum'] = df.apply(lambda x: x.sum())</code></p>
  
  <p>But what I get turns out:</p>
  
  <pre><code>Date 1-Jan 2-Jan 3-Jan     4-Jan
  Duty
  1    Bob   NaN   Bob       NaN
  2    NaN   NaN   Bob       Bob
  3    NaN   NaN   Bob       Bob
  sum  NaN   NaN   BobBobBob NaN
  </code></pre>
  
  <p>I also tried seperate each line into several small Dataframe and try to <code>pd.merge()</code> them which is not work either.</p>