I have a dataframe in which I need to calculate the median of time in the format hh: mm: ss for each user
my code
file['date'] = pd.to_datetime(file['date'])
file['diff'] = file.groupby(['operation', 'user'])['date'].diff().fillna(pd.Timedelta(0)) #calculate the time difference between operations
file = file.loc[file['diff'] <= '00:00:20'] # we leave those where the difference is not more than 20 seconds
results = file.groupby(['operation', 'user'])['diff'].median() #caclulate median
python throws an error - No numeric types to aggregate...
