title: Create Boolean Columns in Pandas Dataframe using Dictionary
body: <p>I am using a network trace dataset, and have loaded the initial data into a pandas dataframe, which looks like this:</p>
  
  <p><a href="https://i.stack.imgur.com/65zuL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/65zuL.png" alt="Initial Dataframe"></a></p>
  
  <p>I have created a python dict with common port numbers and applications names like </p>
  
  <pre><code>port_dict = {80: 'http', 20: 'ftp', 21: 'ftp'}
  </code></pre>
  
  <p>and I want to modify my dataframe by adding additional columns whose names will be the unique values of the <code>ports_dict</code> and if either of <code>sport</code> or <code>dport</code> contains the relevant key, the newly added column should have a value <code>True</code>, <code>False</code> otherwise, like this:</p>
  
  <p><a href="https://i.stack.imgur.com/4LfuK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4LfuK.png" alt="Modified Dataframe"></a></p>
  
  <p>In the above picture, the column <code>https</code> should have <code>True</code> as the sport is <code>443</code>.</p>
  
  <p>How would I go about accomplishing this?</p>