title: How to add a specific pattern to my loop?
body: <p>I have a dataframe like that :</p>
  <p><a href="https://i.stack.imgur.com/W7cgQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/W7cgQ.png" alt="dataframe" /></a></p>
  <p>And I would like an output like that :</p>
  <p><strong>name1 :</strong></p>
  <p><em>mission1 :</em></p>
  <p>sentences1</p>
  <p>sentences2</p>
  <p><em>mission2 :</em></p>
  <p>sentences3</p>
  <p><strong>name2 :</strong></p>
  <p><em>mission1 :</em></p>
  <p>sentences4</p>
  <p><strong>name3 :</strong></p>
  <p><em>mission1 :</em></p>
  <p>sentences5</p>
  <p><em>mission2 :</em></p>
  <p>sentences6</p>
  <p>Here's what I did so far :</p>
  <pre><code>for name in data.Name.unique():
      print(name)
      print()
      for miss in data.Mission.unique():
          print('  ' + miss)
          print()
          for sentence in data.Phrases[(data.Name == name) &amp; (data.Mission == miss)].tolist():
              print('    ' + sentence)
              print()
  </code></pre>
  <p>But unfortunately, there is one little detail not right. This loop give me all the mission by name, even when there is no sentences attached to it.</p>
  <p>Here's my output :</p>
  <p><strong>name1 :</strong></p>
  <p><em>mission1 :</em></p>
  <p>sentences1</p>
  <p>sentences2</p>
  <p><em>mission2 :</em></p>
  <p>sentences3</p>
  <p><strong>name2 :</strong></p>
  <p><em>mission1 :</em></p>
  <p>sentences4</p>
  <p><em>mission2</em>  #HERE tthe mission is specified but with no sentences</p>
  <p><strong>name3 :</strong></p>
  <p><em>mission1 :</em></p>
  <p>sentences5</p>
  <p><em>mission2 :</em></p>
  <p>sentences6</p>
  <p>So, how to tell my loop to not specified the mission when there is no sentences ?</p>