title: pandas apply typeError: 'float' object is not subscriptable
body: <p>I have a dataframe <code>df_tr</code> like this:</p>
  
  <pre><code>      item_id    target   target_sum  target_count
  0        0          0           1            50            
  1        0          0           1            50              
  </code></pre>
  
  <p>I'm trying to find the mean of the target but excluding the target value of the current row, and put the mean value in a new column. The result would be:</p>
  
  <pre><code>     item_id    target   target_sum  target_count item_id_mean_target
  0        0          0           1            50           0.02041
  1        0          0           1            50           0.02041
  </code></pre>
  
  <p>where I computed <code>item_id_mean_target</code> value from the formula:</p>
  
  <pre><code>target_sum - target/target_count - 1
  </code></pre>
  
  <p>...with this code:</p>
  
  <pre><code>df_tr['item_id_mean_target'] = df_tr.target.apply(lambda x: (x['target_sum']-x)/(x['target_count']-1))     
  </code></pre>
  
  <p>I think my solution is correct but instead I got: </p>
  
  <pre><code>TypeError: 'float' object is not subscriptable                
  </code></pre>