title: return the miaximum date for each stock name in a pandas dataframe
body: <p>I am trying to apply a function which returns the latest or maximum date for a stock (on which I have collected prices for multiple days).</p>
  
  <p>I will use this maximum or latest date to go and collect more prices.</p>
  
  <p>my dataframe is currently in the form:</p>
  
  <pre><code>in: df.head()
  columns: index(date) | stock_name
  2015-10-01              A
  2015-10-02              A
  2015-10-05              B
  2015-10-08              B
  
  def max(x):
  return x.idxmax()
  
  df["stock_name"].apply(max)
  out:
  A 2015-10-02
  B 2015-10-08
  </code></pre>