title: Python: Replace a cell value in Dataframe with if statement
body: <p>I have a matrix with that looks like this:</p>
  
  <pre><code>    com 0 1 2 3 4 5
  AAA  0  5 0 4 2 1 4
  ABC  0  9 8 9 1 0 3
  ADE  1  4 3 5 1 0 1
  BCD  1  6 7 8 3 4 1
  BCF  2  3 4 2 1 3 0 ...
  </code></pre>
  
  <p>Where <code>AAA, ABC</code> ... is the dataframe index. The dataframe columns are <code>com 0 1 3 4 5 6</code></p>
  
  <p>I want to set the cell values in my dataframe equal to 0 when the row values of <code>com</code> is equal the column "number". So for instance, the above matrix will look like:</p>
  
  <pre><code>    com 0 1 2 3 4 5
  AAA  0  0 0 4 2 1 4
  ABC  0  0 8 9 1 0 3
  ADE  1  4 0 5 1 0 1
  BCD  1  6 0 8 3 4 1
  BCF  2  3 4 0 1 3 0 ...
  </code></pre>
  
  <p>I tried to iterate over rows and use both <code>.loc</code> and <code>.ix</code> but no success.</p>