title: pandas manual way of one hot encode
body: <p>I have a dataframe as given below and trying to convert one hot encode it (kind of)</p>
  <pre><code>pd.DataFrame(
      {0: {0: 'eng', 1: 'eng', 2: 'mat', 3: 'fre', 4: 'soc', 5: 'eng',
           6: 'eng', 7: 'mat', 8: 'fre', 9: 'soc'},
       1: {0: 'mat', 1: 'phy', 2: 'bio', 3: 'phy', 4: 'mat', 5: 'mat',
           6: 'phy', 7: 'bio', 8: 'mat', 9: 'mat'},
       2: {0: 'che', 1: 'che', 2: None, 3: 'soc', 4: 'lit', 5: 'che',
           6: 'che', 7: None, 8: 'eng', 9: 'lit'},
       3: {0: None, 1: None, 2: None, 3: None, 4: None, 5: None,
           6: None, 7: None, 8: 'phy', 9: None}})
  </code></pre>
  <p>resultant output I am require is</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>eng</th>
  <th>mat</th>
  <th>che</th>
  <th>phy</th>
  <th>lit</th>
  <th>fre</th>
  <th>soc</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>1</td>
  <td>1</td>
  <td>1</td>
  <td>0</td>
  <td>0</td>
  <td>0</td>
  <td>0</td>
  </tr>
  <tr>
  <td>1</td>
  <td>0</td>
  <td>1</td>
  <td>1</td>
  <td>0</td>
  <td>0</td>
  <td>0</td>
  </tr>
  <tr>
  <td>0</td>
  <td>0</td>
  <td>0</td>
  <td>0</td>
  <td>0</td>
  <td>0</td>
  <td>0</td>
  </tr>
  <tr>
  <td>0</td>
  <td>0</td>
  <td>0</td>
  <td>1</td>
  <td>0</td>
  <td>1</td>
  <td>1</td>
  </tr>
  <tr>
  <td>0</td>
  <td>1</td>
  <td>0</td>
  <td>0</td>
  <td>1</td>
  <td>0</td>
  <td>1</td>
  </tr>
  <tr>
  <td>1</td>
  <td>1</td>
  <td>1</td>
  <td>0</td>
  <td>0</td>
  <td>0</td>
  <td>0</td>
  </tr>
  <tr>
  <td>1</td>
  <td>0</td>
  <td>1</td>
  <td>1</td>
  <td>0</td>
  <td>0</td>
  <td>0</td>
  </tr>
  <tr>
  <td>0</td>
  <td>0</td>
  <td>0</td>
  <td>0</td>
  <td>0</td>
  <td>0</td>
  <td>0</td>
  </tr>
  <tr>
  <td>0</td>
  <td>1</td>
  <td>0</td>
  <td>0</td>
  <td>0</td>
  <td>1</td>
  <td>0</td>
  </tr>
  <tr>
  <td>0</td>
  <td>1</td>
  <td>0</td>
  <td>0</td>
  <td>1</td>
  <td>0</td>
  <td>1</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>I need to do it without using any libraries except pandas, any idea how I can do it?</p>