import numpy as np
import pandas as pd
#import begins
df = pd.read_csv('la.csv', error_bad_lines=False, skiprows=2)
#import ends
#munging begins
df_cleaned = df.drop(['Unnamed: 6'], axis=1)
df_cleaned = df_cleaned[pd.notnull(df_cleaned['Month'])]
df_cleaned['Absences/Lates (Hours)'] = 0.0
df_cleaned['Absences/Lates (Hours)'] = df_cleaned['Duration'].str.split(':').apply(lambda x: (int(x[0]) * 60 + int(x[1])) / 60)
#munging ends
#formatting begins
df_cleaned.pivot_table(index=['Team', 'Agent'], values='Absences/Lates (Hours)', margins=True, aggfunc=sum)