title: On the basis of record in a single column, update a new date column
body: <p>Input file looks like:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th style="text-align: left;">policy</th>
  <th style="text-align: center;">eff_date</th>
  <th style="text-align: right;">cust_id</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td style="text-align: left;">abcd</td>
  <td style="text-align: center;">2/12/2020</td>
  <td style="text-align: right;">9879</td>
  </tr>
  <tr>
  <td style="text-align: left;">bcdf</td>
  <td style="text-align: center;">2/10/2020</td>
  <td style="text-align: right;">654654</td>
  </tr>
  <tr>
  <td style="text-align: left;">bcdf</td>
  <td style="text-align: center;">3/11/2020</td>
  <td style="text-align: right;">9879</td>
  </tr>
  <tr>
  <td style="text-align: left;">abcd</td>
  <td style="text-align: center;">5/11/2020</td>
  <td style="text-align: right;">64643</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>On the basis of duplicate policy number, i want to update minimum eff_date for the duplicate one in eff_Date column</p>
  <p>Among 2 abcd record, lower eff_date is 2/12/2020, so 2/12/2020 should be updated for the duplicate abcd as well. DROP IS NOT REQUIRED.</p>
  <p>My output should look like:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th style="text-align: left;">policy</th>
  <th style="text-align: center;">eff_date</th>
  <th style="text-align: right;">cust_id</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td style="text-align: left;">abcd</td>
  <td style="text-align: center;">2/12/2020</td>
  <td style="text-align: right;">9879</td>
  </tr>
  <tr>
  <td style="text-align: left;">bcdf</td>
  <td style="text-align: center;">2/10/2020</td>
  <td style="text-align: right;">654654</td>
  </tr>
  <tr>
  <td style="text-align: left;">bcdf</td>
  <td style="text-align: center;">2/10/2020</td>
  <td style="text-align: right;">9879</td>
  </tr>
  <tr>
  <td style="text-align: left;">abcd</td>
  <td style="text-align: center;">2/12/2020</td>
  <td style="text-align: right;">64643</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>Below is the code i tried, but is completely wrong it seems logic wise:</p>
  <pre><code>
  import pandas as pd
  
  import io
  
  df = pd.read_csv(r'C:\Users\n891000\Desktop\inputfile.csv',index_col=False, sep=',')
  
  df=df.sort_values(by=['eff_Date'],ascending=False)
  
  boolean = df.duplicated(subset=['policy']).any()
  
  print(boolean, end='\n\n') # True
  
  if boolean==True:
  
    for i in range(0,3):
  
      if df['policy'][i]== df['policy'][i+1]:
  
        df['eff_Date'][i]=min(df['eff_Date'][i+1])
  
  df.to_csv(r'C:\Users\n891000\Desktop\outputfile.csv',index=False)
  
  </code></pre>
  <p>Please let me know where i am going wrong and how to achieve the output as stated above.</p>