title: Unable to process list of sets having multiple element in list when list of set can be empty
body: <p>When I scrape websites for all the emails on each website and try to output it, I can get a given data frame which is a list of sets of multiple elements for each website :</p>
  <pre><code>URL_WITH_EMAILS_DF = pd.DataFrame(data=[{'main_url': 'http://keilstruplund.dk', 'emails': [{'ole.norlin@mail.dk', 'ole.gregersen@hk.dk'}, set(),{'ole.norlin@mail.dk', 'ole.gregersen@hk.dk'}, {'ole.norlin@mail.dk', 'ole.gregersen@hk.dk'}, {'ole.norlin@mail.dk', 'ole.gregersen@hk.dk'}, {'ole.norlin@mail.dk', 'ole.gregersen@hk.dk'}, {'ole.norlin@mail.dk', 'ole.gregersens@hk.dk', 'ole.gregersen@hk.dk'}, {'ole.norlin@mail.dk', 'ole.gregersen@hk.dk'}, {'ole.norlin@mail.dk', 'ole.gregersen@hk.dk'}, {'ole.norlin@mail.dk', 'ole.gregersen@hk.dk'}, {'ole.norlin@mail.dk', 'ole.gregersen@hk.dk'}, {'ole.norlin@mail.dk', 'ole.gregersen@hk.dk'}, {'ole.norlin@mail.dk', 'ole.gregersen@hk.dk'}, {'ole.norlin@mail.dk', 'ole.gregersen@hk.dk'}, {'ole.norlin@mail.dk', 'ole.gregersen@hk.dk'}, {'ole.norlin@mail.dk', 'ole.gregersen@hk.dk'}, {'ole.norlin@mail.dk', 'ole.gregersen@hk.dk'}, {'prima-rent@youseepost.dk', 'jb@rentind.dk', 'frisoren01@gmail.com', 'ole.norlin@mail.dk', 'ole.gregersen@hk.dk'}, {'ole.norlin@mail.dk', 'ole.gregersen@hk.dk'}, {'stigterndrup@gmail.com', 'psn@psn.dk', 'samuel@malerfirmaet-lykkebo.dk', 'jan@mundt-reklame.dk', 'ole.norlin@mail.dk', 'nordsjalland@phonixtag.dk', 'jp@rudersdalmaleren.dk', 'vvs@hestetangen.dk', 'steenkragelund@mail.tele.dk', 'ole.gregersen@hk.dk'}, {'ole.norlin@mail.dk', 'ole.gregersen@hk.dk'}, {'ole.norlin@mail.dk', 'ole.gregersen@hk.dk'}, {'ole.norlin@mail.dk', 'kasserer@keilstruplund.dk', 'ole.gregersen@hk.dk'}, {'ole.norlin@mail.dk', 'ole.gregersen@hk.dk'}, {'ole.norlin@mail.dk', 'ole.gregersen@hk.dk'}, {'ole.norlin@mail.dk', 'ole.gregersen@hk.dk'}, {'ole.norlin@mail.dk', 'ole.gregersen@hk.dk'}, {'ole.norlin@mail.dk', 'ole.gregersen@hk.dk'}, {'ole.norlin@mail.dk', 'ole.gregersen@hk.dk'}, {'ole.norlin@mail.dk', 'ole.gregersen@hk.dk'}, {'ole.norlin@mail.dk', 'ole.gregersen@hk.dk'}]}, 
                                      {'main_url': 'http://kirsebaergaarden.com', 'emails': [{'info@kirsebaergaarden.com'}, {'info@kirsebaergaarden.com'}, {'info@kirsebaergaarden.com'}, {'info@kirsebaergaarden.com'}, {'info@kirsebaergaarden.com'}, {'info@kirsebaergaarden.com'}, {'info@kirsebaergaarden.com'}, {'info@kirsebaergaarden.com'}, {'info@kirsebaergaarden.com'}, {'soesterb@gmail.com', 'info@kirsebaergaarden.com'}, {'info@kirsebaergaarden.com'}, {'info@kirsebaergaarden.com'}, {'info@kirsebaergaarden.com'}, {'info@kirsebaergaarden.com'}, {'info@kirsebaergaarden.com'}]},
                                       {'main_url': 'http://koglernes.dk', 'emails': [{'info@koglernes.dk'}, {'info@koglernes.dk'}, {'info@koglernes.dk'}, {'info@koglernes.dk'},set(), set(), {'info@koglernes.dk'}, {'info@koglernes.dk'}]},
                                        {'main_url': 'http://kongehojensbornehave.dk', 'emails': [set()]}
                                     ])
  </code></pre>
  <p><a href="https://i.stack.imgur.com/OvlnH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OvlnH.png" alt="enter image description here" /></a></p>
  <p>However, I want to process the data frame to  look like the following:</p>
  <pre><code>URL_WITH_EMAILS_DF = pd.DataFrame(data=[{'main_url': 'http://keilstruplund.dk', 'emails': ['ole.norlin@mail.dk', 'ole.gregersen@hk.dk', 'prima-rent@youseepost.dk', 'jb@rentind.dk', 'frisoren01@gmail.com','stigterndrup@gmail.com', 'psn@psn.dk', 'samuel@malerfirmaet-lykkebo.dk', 'jan@mundt-reklame.dk',  'nordsjalland@phonixtag.dk', 'jp@rudersdalmaleren.dk', 'vvs@hestetangen.dk', 'steenkragelund@mail.tele.dk', 'kasserer@keilstruplund.dk']},                                        
                                       {'main_url': 'http://kirsebaergaarden.com', 'emails': ['info@kirsebaergaarden.com']},
                                       {'main_url': 'http://koglernes.dk', 'emails': ['info@koglernes.dk']},
                                        {'main_url': 'http://kongehojensbornehave.dk', 'emails': []}
                                     ])
  </code></pre>
  <p><a href="https://i.stack.imgur.com/W52aT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/W52aT.png" alt="enter image description here" /></a></p>
  <p>How can it be achieve?</p>
  <p>I have tried the following code but it only manage to <strong>return first element of first set only while running to error when there is no element in the email list</strong> for a given website :</p>
  <pre><code>URL_WITH_EMAILS_DF['emails'] = [', '.join(x.pop()) if not None else &quot;&quot; for x in URL_WITH_EMAILS_DF['emails'].values]
  </code></pre>
  <p><strong>P.S:</strong></p>
  <ol>
  <li>As per the first data frame, I needed to get a set of multiple emails to be inserted because there can be multiple webpages for a single website and I do not want to take duplicate emails from each web page</li>
  <li>If a list has [set(), set()] or [], it should be consider as empty. Also if set() is available as a value on 'emails' it just throw &quot;TypeError: 'NoneType' object is not iterable&quot;.</li>
  <li>Thanks to <a href="https://stackoverflow.com/users/4718350/chris">Chris</a>, he provided a solution here. However, it shows error mentioned in point#2. The solution is as follows:</li>
  </ol>
  <pre><code>from itertools import chain
          URL_WITH_EMAILS_DF['emails'] = URL_WITH_EMAILS_DF.emails.apply(lambda x: list(set(chain.from_iterable(x))))
  </code></pre>