Combine multiple row into single row if index are sequentially

It,s look like i want to convert multiple row to single row in animal column. But, it only conditional if they met sequential number and lowercase alphabet. after that, it restart an index to become sequent

So, i have a dataframe like :

    Animal 
 0  Bulldog
 1  hatcet 
 3  Parrot 
 7  Carrot 
 8  Jack Dog
 9  Kanggaroo
 10 helma  

Thing i want to achieve is

    Animal 
 0  Bulldog hatcet 
 1  Parrot
 2  Carrot 
 3  Jack Dog
 4  Kanggaroo helma
 

Anyone can pass this?

Answer

We can identify the sequential blocks by first creating a boolean mask using str.contains then taking cumulative sum on the mask. then group the column Animal on these sequential blocks and aggregate using join

b = df['Animal'].str.contains(r'^[A-Z]').cumsum()
df[['Animal']].groupby(b, as_index=False).agg(' '.join)

            Animal
0   Bulldog hatcet
1           Parrot
2           Carrot
3         Jack Dog
4  Kanggaroo helma