title: I am trying to write a For Loop in Python to identify types of sales for use with a 'sales report'
body: <p>UPDATED - 4.13.22</p>
  <p>I am new to programming python and am trying to create a program using For Loops that will go through a data frame by rows to identify different types of 'group sales' made up by different combinations of product sales and posting the results in a 'Result' column.</p>
  <p>I was told in previous comments to print the df and paste it:</p>
  <pre><code>Date  LFMIX SALE  LCSIX SALE  LOTIX SALE  LSPIX SALE  LEQIX SALE  \
  0   0.0         0.0     30000.0         0.0         0.0         0.0   
  1   0.0         0.0     30000.0         0.0         0.0         0.0   
  2   0.0     30000.0         0.0         0.0         0.0         0.0   
  3   0.0     25000.0     25000.0         0.0         0.0         0.0   
  4   0.0     30000.0     30000.0         0.0         0.0         0.0   
  5   0.0     30000.0         0.0         0.0         0.0     30000.0   
  6   0.0         0.0     30000.0         0.0         0.0     30000.0   
  7   0.0     25000.0     25000.0         0.0         0.0     25000.0   
  
     AUM LFMIX  AUM LCSIX  AUM LOTIX  AUM LSPIX  AUM LEQIX  \
  0   200000.0        0.0        0.0        0.0        0.0   
  1   500000.0        0.0        0.0        0.0        0.0   
  2        0.0   200000.0        0.0        0.0        0.0   
  3        0.0        0.0        0.0        0.0        0.0   
  4        0.0        0.0        0.0        0.0   200000.0   
  5        0.0   200000.0        0.0        0.0        0.0   
  6   200000.0        0.0        0.0        0.0        0.0   
  7        0.0        0.0        0.0        0.0        0.0   
  
     is the sale = 10% of pairing fund AUM  LFMIX  LCSIX  LOTIX  LSPIX  LEQIX  \
  0                                    0.0      1      1    0.0    0.0    0.0   
  1                                    0.0      1      1    0.0    0.0    0.0   
  2                                    0.0      1      1    0.0    0.0    0.0   
  3                                    0.0      1      1    0.0    0.0    0.0   
  4                                    0.0      1      1    0.0    0.0    1.0   
  5                                    0.0      1      1    0.0    0.0    1.0   
  6                                    0.0      1      1    0.0    0.0    1.0   
  7                                    0.0      1      1    0.0    0.0    1.0   
  
    Expected_Result Result  
  0             DP1         
  1               0         
  2             DP2         
  3             DP3         
  4             TT1         
  5             TT2         
  6             TT3         
  7             TT4         
  </code></pre>
  <p>my Python code to sort just the 1st row:</p>
  <pre><code>for row in range(len(df)):                                                                       
   if (df[&quot;LCSIX&quot;][row] &gt;= (df[&quot;AUM LFMIX&quot;][row] * .1)): df[&quot;Result&quot;][row] = &quot;DP1&quot;
  </code></pre>
  <p>and the results:</p>
  <pre><code>   Date  LFMIX SALE  LCSIX SALE  LOTIX SALE  LSPIX SALE  LEQIX SALE  \
  0   0.0         0.0     30000.0         0.0         0.0         0.0   
  1   0.0         0.0     30000.0         0.0         0.0         0.0   
  2   0.0     30000.0         0.0         0.0         0.0         0.0   
  3   0.0     25000.0     25000.0         0.0         0.0         0.0   
  4   0.0     30000.0     30000.0         0.0         0.0         0.0   
  5   0.0     30000.0         0.0         0.0         0.0     30000.0   
  6   0.0         0.0     30000.0         0.0         0.0     30000.0   
  7   0.0     25000.0     25000.0         0.0         0.0     25000.0   
  
     AUM LFMIX  AUM LCSIX  AUM LOTIX  AUM LSPIX  AUM LEQIX  \
  0   200000.0        0.0        0.0        0.0        0.0   
  1   500000.0        0.0        0.0        0.0        0.0   
  2        0.0   200000.0        0.0        0.0        0.0   
  3        0.0        0.0        0.0        0.0        0.0   
  4        0.0        0.0        0.0        0.0   200000.0   
  5        0.0   200000.0        0.0        0.0        0.0   
  6   200000.0        0.0        0.0        0.0        0.0   
  7        0.0        0.0        0.0        0.0        0.0   
  
     is the sale = 10% of pairing fund AUM  LFMIX  LCSIX  LOTIX  LSPIX  LEQIX  \
  0                                    0.0      1      1    0.0    0.0    0.0   
  1                                    0.0      1      1    0.0    0.0    0.0   
  2                                    0.0      1      1    0.0    0.0    0.0   
  3                                    0.0      1      1    0.0    0.0    0.0   
  4                                    0.0      1      1    0.0    0.0    1.0   
  5                                    0.0      1      1    0.0    0.0    1.0   
  6                                    0.0      1      1    0.0    0.0    1.0   
  7                                    0.0      1      1    0.0    0.0    1.0   
  
    Expected_Result Result  
  0             DP1         
  1               0         
  2             DP2    DP1  
  3             DP3    DP1  
  4             TT1    DP1  
  5             TT2    DP1  
  6             TT3         
  7             TT4    DP1 
  </code></pre>
  <p>As you can see, the code fail to identify row[0] as a DP1 and misidentifies other rows.</p>
  <p>I am planning on coding 'For Loops' that will identify 17 different types of group sales, this is simply the 1st group I am trying to identify...</p>
  <p>Thanks for the help.</p>