title: Use of loc to update a dataframe python pandas
body: <p>I have a pandas dataframe (df) with the column structure : </p>
  
  <pre><code>month a b c d
  </code></pre>
  
  <p>this dataframe has data for say Jan, Feb, Mar, Apr. A,B,C,D are numeric columns. For the month of Feb , I want to recalculate column A and update it in the dataframe i.e. for month = Feb, A = B + C + D</p>
  
  <p>Code I used : </p>
  
  <pre><code> df[df['month']=='Feb']['A']=df[df['month']=='Feb']['B'] + df[df['month']=='Feb']['C'] + df[df['month']=='Feb']['D'] 
  </code></pre>
  
  <p>This ran without errors but did not change the values in column A for the month Feb. In the console, it gave a message that :</p>
  
  <blockquote>
    <p>A value is trying to be set on a copy of a slice from a DataFrame.<br>
        Try using .loc[row_indexer,col_indexer] = value instead</p>
  </blockquote>
  
  <p>I tried to use .loc but right now the dataframe I am working on, I had used <code>.reset_index()</code> on it and I am not sure how to set index and use .loc. I followed documentation but not clear. Could you please help me out here?
  This is an example dataframe :</p>
  
  <pre><code> import pandas as pd import numpy as np
   dates = pd.date_range('1/1/2000', periods=8)
   df = pd.DataFrame(np.random.randn(8, 4), index=dates, columns=['A', 'B', 'C', 'D']) 
  </code></pre>
  
  <p>I want to update say one date : 2000-01-03. I am unable to give the snippet of my data as it is real time data.</p>