I have a 1D array containing -1,0,1

```
Mask
Out[6]: array([0, 0, 0, -1, -1, 0, 0, 1, 1])

```

I would like to find the start and the end indices of groups of equal values.
This can be stored in a dataframe in which the first column is the start index, the second column the end index, and the tirdh column the value that is repeated.

```
start end value
0,    2,  0
3,    4,  -1
5,    6,  0
7,    8,  1

```

Is there a way to do this or I have to use a loop over the `Mask`?
Hereby my attempt

```
Change =pd.DataFrame(columns=['Start','End','Value'])

i=-1
while i <len(Mask)-1:
    i = i + 1
    start = i
    end = i
    value = Mask[start]
    if i <len(Mask)-1:
       while Mask[i]==Mask[i+1]:
          i = i +1
          end = i
          if i >=len(Mask)-1:
              end = i + 1 
              break

    detected = []
    detected .append([start,end,value])
    detected = np.array(detected )
    detected = pd.DataFrame(detected , columns=['Start','End','Value'])    
    Change = pd.concat([Change , detected ], ignore_index=True)[Change .columns.tolist()]

```