title: python: print max value of a variable for each value of another variable
body: <p>Given this pandas dataframe, I am trying to print the maximum value of time for each value under categ. For instance, since max time of A=6, max time of B=9 and  max time of C=9, I would like to print something like time=9:2, time=6:1.
  How would you do it?</p>
  <pre><code>import numpy as np
  import pandas as pd
  import matplotlib.pyplot as plt
  from sklearn.model_selection import train_test_split
  import xgboost as xgb
  import datetime
  import seaborn as sns
  from sklearn.metrics import r2_score
  
  data=[[1, 1,2 ,5,'A'],
          [2, 5,5,6,'A'],
          [3, 4,6,6,'A']
          ,[5, 6,5,6,'A'],
          [7,9,9,7,'B'],
          [8, 7,9,4,'B']
          ,[9, 2,3,8,'B'],
          [2, 5,1,9,'B'],
          [2,2,10,9,'C']
          ,[2, 8,2,8,'C'],
          [9, 5,4,10,'C'],
          [6, 8,5 ,10,'C']]
  
  df = pd.DataFrame(data, columns=['time','x','y','target','categ'])
  </code></pre>