I want to split a DataFrame based on if a row contains a certain string "Customer" and all subsequent rows until another row that contains "Customer", i.e.
c_name | cost | p_date
Customer: xx | |
hat | 12 | 1/1/2018
bat | 13 | 2/3/2018
Customer: xy | |
mat | 14 | 1/2/2018
to DF1
c_name | cost | p_date
Customer: xx | |
hat | 12 | 1/1/2018
bat | 13 | 2/3/2018
DF2
c_name | cost | p_date
Customer: xy | |
mat | 14 | 1/2/2018
I know I can get where to split the DataFrame based on df.c_name.str.contains('Customer'), but how do I use that to split the DataFrame?