'How do I count the amount of lines (products) after a certain keyword?

I am trying to create a dataframe from all receipts of a supermarket. However, I cant seem to get the 'count' of the amount of items in a particular receipt.

Example receipt:

Kassanummer: x Datum: xx-xx-xxxx Caissiere: x Begintijd: xx:xx:xx Transactie: xxx Eindtijd: xx:xx:xx

                             EUR
         AH BONUS NR.   xxxxxxxx
         COOLBEST           2,25
         COOLBEST           2,25

         SUBTOTAAL          4,50

  BONUS  ALLECOOLBEST      -2,25
          50.00%x EUR 4,50  
             1  COOLBEST
             1  COOLBEST

         SUBTOTAAL          2,25
  TOTAAL                    2,25

         CONTANT            5,00
         TERUG              2,75

  UW AH BONUS
  VOORDEEL                  2,25

          BTW     OVER       EUR
         21.0%     0,00     0,00
          9.0%     2,06     0,19
          0.0%     0,00     0,00
         TOTAAL    2,06     0,19

There are always 2 lines between Eindtijd: xx:xx:xx and the list ends 2 lines before SUBTOTAAL.

Does anyone know how I can create a count of these lines to add them to my dataframe?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source