Given a dataframe df:
import pandas as pd
df = pd.DataFrame({"changes":['increase', 'constant', 'constant', 'constant', 'decline', 'constant', 'constant', 'increase', 'constant', 'constant', 'constant','decline', 'constant', 'constant', 'constant',})
output:
| changes |
|---|
| increase |
| constant |
| constant |
| constant |
| decline |
| constant |
| constant |
| increase |
| constant |
| constant |
| constant |
| decline |
| constant |
| constant |
| constant |
The task is to delete the rows with decline and the constant that comes after it.
I do not want to remove increase and the constant coming after it.
The expected output in this case should look like:
| changes |
|---|
| increase |
| constant |
| constant |
| constant |
| increase |
| constant |
| constant |
| constant |
