a = np.array([3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 1, 1, 1, 1, 4, 4, 12, 12, 12])
prev = 0
splits = np.append(np.where(np.diff(a) != 0)[0], len(a) + 1) + 1
for split in splits:
    print(np.arange(1, a.size + 1, 1)[prev:split])
prev = split
Finding consecutive segments in a pandas data frame