title: Get the latest data for each customer from pandas dataframe
body: <p>I am trying to get the latest data for every customer regardless of other attributes in the dataframe.</p>
  <p>My dataframe looks like this</p>
  <p><img src="https://i.stack.imgur.com/abjWm.png" alt="enter image description here" /></p>
  <p>My output should look like this</p>
  <p><img src="https://i.stack.imgur.com/JONT8.png" alt="My output should look like this" /></p>
  <p>I have tried 'df.iloc[df.groupby('customer')['date'].idxmax()]' but I am getting ValueError.</p>
  <p>&quot;ValueError                                Traceback (most recent call last)
   in 
  ----&gt; 1 df = df.iloc[df.groupby('cutomer')['date'].idxmax()]</p>
  <p>~\Anaconda3\envs\myenv\lib\site-packages\pandas\core\groupby\groupby.py in wrapper(*args, **kwargs)
  653             if self.obj.ndim == 1:
  654                 # this can be called recursively, so need to raise ValueError
  --&gt; 655                 raise ValueError
  656
  657             # GH#3688 try to operate item-by-item</p>
  <p>ValueError: &quot;</p>