def Full_coverage_new(group):
    if len(group) > 1:
        mask = group.values[1:, (4)] != group.values[:-1, (5)]
if np.any(mask):
    err = 'Expected startpoint: {0} (row {1}) Found startpoint: {2} (row {3})'
incomplete_coverage.extend([err.format(group.iloc[i, 5], group.index[i],
    group.iloc[i + 1, 4], group.index[i + 1]) for i in np.where(mask)[0]])
return 0
incomplete_coverage = []
cols = ['ID_number', 'TimeOfDay', 'TypeOfCargo', 'TrackStart']
df_s = df.sort_values(['SectionStart', 'SectionStop'])
df_s.groupby(cols).apply(Full_coverage_nosort)
Группа Pandas применяет медленное выполнение