I need a help to build Dataframe in python where if a sequence of month is missing it will create a new row with Monthly Revenue as 0. the check for sequence of Month will be till Total Age of particular VIN. Below are the Dataframes.
CurrentDf:
| VIN | Total Age | Months | Monthly Revenue |
|---|---|---|---|
| v1 | 10 | 00 | 1513 |
| v1 | 10 | 05 | 1108 |
| v1 | 10 | 07 | 4330 |
| v1 | 10 | 09 | 7121 |
| v2 | 08 | 01 | 1998 |
| v2 | 08 | 04 | 4997 |
| v2 | 08 | 05 | 8528 |
| v2 | 08 | 06 | 1783 |
| v2 | 08 | 07 | 9628 |
| v2 | 08 | 08 | 2082 |
OutputDf:
| VIN | Total Age | Months | Monthly Revenue |
|---|---|---|---|
| v1 | 10 | 00 | 1513 |
| v1 | 10 | 01 | 00 |
| v1 | 10 | 02 | 00 |
| v1 | 10 | 03 | 00 |
| v1 | 10 | 04 | 00 |
| v1 | 10 | 05 | 1108 |
| v1 | 10 | 06 | 00 |
| v1 | 10 | 07 | 433 |
| v1 | 10 | 08 | 00 |
| v1 | 10 | 09 | 7121 |
| v1 | 10 | 10 | 00 |
| V2 | 08 | 00 | 00 |
| v2 | 08 | 01 | 1998 |
| v2 | 08 | 02 | 00 |
| v2 | 08 | 03 | 00 |
| v2 | 08 | 04 | 4997 |
| v2 | 08 | 05 | 8528 |
| v2 | 08 | 06 | 1783 |
| v2 | 08 | 07 | 9628 |
| v2 | 08 | 08 | 2082 |