title: How would you go about finding the latest date in a dataframe groupby?
body: <p>I am attempting to create a sub-table from a larger dataset which lists out the unique ID, the name of the person and the date they attended an appointment.</p>
  <p>For example,</p>
  <pre><code>df = pd.DataFrame({'ID': ['abc', 'def', 'abc', 'abc'], 
                     'name':['Alex','Bertie','Alex','Alex'],
                     'date_attended':['01/01/2021','05/01/2021','11/01/2021','20/01/2021']
  </code></pre>
  <p>What I would like is a dataframe, that shows the last time Alex and Bertie attended a class. So my dataframe would like:</p>
  <pre><code>name      date_attended
  Alex      20/01/2021
  Bertie    05/01/2021
  </code></pre>
  <p>I'm really struggling with this! So far I have tried (based off a previous question I saw here):</p>
  <pre><code>max_date_list = ['ID','date_attended']
  df = df.groupby(['ID'])[max_date_list].transform('max').size()
  </code></pre>
  <p>but I keep getting an error. I know this would involve a <code>groupby</code> but I can't figure out how to get the maximum date. Would anyone know how to do this?</p>