Combine multiple row pandas if met NaN Values and lowercase in 2 cell

My problem are i want to make them as single row. But, it only conditionally when it met lowercase under the row in Xlabel. on another side, multiple rows are shrinked make Ylabel only with NaN values to be shrinked as well

So i have dataframe like :

    Xlabel      Ylabel
  0 Baby doll   240.0
  1 Benet doll  30.0
  2 lingling    NaN
  3 Kurachaa    NaN
  4 mothers     NaN
  5 day         NaN
  6 Grape day   100.0
  7 holidays    NaN
  8 Halari doom 90.0
  9 Korsira ja  110.0
 10 Hujarata    940.0
 11 hoom hoom   NaN
 12 laka laka   NaN
 13 cherry      NaN
 

Then become like

  xlabel                              Ylabel
0 Baby doll                           240.0
1 Benet doll lingling                 30.0
2 Kurachaa mothers day                NaN
3 Grape day holidays                  100.0
4 Halari doom                         90.0
5 Korsira ja                          110.0
6 Hujarata hoom hoom laka laka cherry 940.0

How can i achieve this?

Answer

We can use str.contains to check for the occurrence of first upper case letter in the strings of column Xlabel then take cumulative sum on this boolean mask to identify the sequential blocks of words belonging to same sentence, finally group the dataframe on these blocks and aggregate the column Xlabel using join and Ylabel using first

b = df['Xlabel'].str.contains(r'^[A-Z]').cumsum()
df.groupby(b, as_index=False).agg({'Xlabel': ' '.join, 'Ylabel': 'first'})

                                Xlabel  Ylabel
0                            Baby doll   240.0
1                  Benet doll lingling    30.0
2                 Kurachaa mothers day     NaN
3                   Grape day holidays   100.0
4                          Halari doom    90.0
5                           Korsira ja   110.0
6  Hujarata hoom hoom laka laka cherry   940.0