+---+----+
| A | B  |
+---+----+
| 4 | VK |
| 9 | MD |
| 9 | V  |
| 8 | VK |
| 9 | V  |
| 1 | N  |
| 9 | V  |
| 7 | VK |
| 0 | MD |
| 9 | VK |
| 8 | V  |
+---+----+
I want to create new rows from the given dataset (two columns). For example, in the given dataset I want to select a row based on 'B' column value 'VK' and two previous rows of Column 'A' to create a new row. So, that first row should be like
+---+---+---+----+
| 9 | 9 | 4 | VK |
+----------------+
So, new row  = ( Row that has 'VK' + add two previous values of column A )
             = [4 | VK] + [ 9 | 9]
             = [ 9 | 9] + [4 | VK]
This process should iterate and we should have a dataset like:
+---+---+---+----+
| 9 | 9 | 4 | VK |
| 1 | 9 | 8 | VK |
| 9 | 0 | 7 | VK |
+----------------+
Input df:
df = pd.DataFrame([[4,"VK"],
[ 9,"MD" ],
[ 9,"V"  ],
[ 8,"VK" ],
[ 9,"V"  ],
[ 1,"N"  ],
[ 9,"V"  ],
[ 7,"VK" ],
[ 0,"MD" ],
[ 9,"VK" ],
[ 8,"V"  ]],columns = [ "A" , "B"])
 
     
    