Testing
import pandas as pd file_path = '/tmp/tt.xlsx' df = pd.read_excel(file_path) # Make sure the column name is exactly correct (case sensitive!) # Convert to proper timedelta (assuming the values look like "2 days 3:45:12" or "1:30:00" etc.) df['UnPlanDownTime'] = pd.to_timedelta(df['UnPlanDownTime'].astype(str)) # Group and sum downtime_by_resource = ( df.groupby('Resources', as_index=False)['UnPlanDownTime'] .sum() ) # Sort descending by total downtime result = downtime_by_resource.sort_values('UnPlanDownTime', ascending=False) # Show it print(result) # Optional: nicer format print("\nTop unplanned downtime by resource:") print(result.head(10))