title: Pandas: Merge two string columns in Python, remove duplicated strings and remove unwanted string unless only unwanted string left
body: <p>I'm trying to merge two string columns and I wish to get rid of <code>'others'</code> if the counter value is a 'non-others' value - like <code>'apple' + 'others' = 'apple'</code> but <code>'others' + 'others' = 'others'</code>. I managed the 2nd condition but how can I accommodate the two conditions on the merge?</p>
  <pre><code>data = {'fruit1':[&quot;organge&quot;, &quot;apple&quot;, &quot;organge&quot;, &quot;organge&quot;, &quot;others&quot;],
          'fruit2':[&quot;apple&quot;, &quot;others&quot;, &quot;organge&quot;, &quot;watermelon&quot;, &quot;others&quot;]}
  df = pd.DataFrame(data)
  
  df[&quot;together&quot;] = df[&quot;fruit1&quot;] + ' ' + df[&quot;fruit2&quot;]
  df[&quot;together&quot;] = df[&quot;together&quot;].apply(lambda x: ' '.join(pd.unique(x.split())))
  
      fruit1      fruit2            together
  0  organge       apple       organge apple
  1    apple      others        apple others
  2  organge     organge             organge
  3  organge  watermelon  organge watermelon
  4   others      others              others
  </code></pre>
  <p>Expected output:</p>
  <pre><code>    fruit1      fruit2            together
  0  organge       apple       organge apple
  1    apple      others               apple
  2  organge     organge             organge
  3  organge  watermelon  organge watermelon
  4   others      others              others
  </code></pre>