Need Help, I'm trying to get a Date column based on user input it will decrease the current date with one month interval with increase in Total Age column Number.
CurrentDf = {
"VIN": ['v1','v1','v1','v2','v2','v2','v2','v3','v3','v3'],
"Total Age": [10,10,10, 08,08,08,08,11,11,11],
"Months": [05,07,09,01,06,07,08,02,05,07],
"Monthly Revenue": [1108,4330,7121,1998,1783,9628, 2082,8763,5683, 5780]
}
Total_Age = [int(x) for x in input('Please enter Total Age?= ').split(',')]
CurrentDf:
VIN | Total Age | Months | Monthly Revenue |
---|---|---|---|
v1 | 10 | 05 | 1108 |
v1 | 10 | 07 | 4330 |
v1 | 10 | 09 | 7121 |
v2 | 08 | 01 | 1998 |
v2 | 08 | 06 | 1783 |
v2 | 08 | 07 | 9628 |
v2 | 08 | 08 | 2082 |
v3 | 11 | 02 | 8763 |
v3 | 11 | 05 | 5683 |
v3 | 11 | 07 | 5780 |
UserInput: [8]
outputDF:
VIN | Total Age | Months | Monthly Revenue | Date |
---|---|---|---|---|
v1 | 10 | 05 | 1108 | 2022-04-01 |
v1 | 10 | 07 | 4330 | 2022-04-01 |
v1 | 10 | 09 | 7121 | 2022-04-01 |
v2 | 08 | 01 | 1998 | 2022-05-01 |
v2 | 08 | 06 | 1783 | 2022-05-01 |
v2 | 08 | 07 | 9628 | 2022-05-01 |
v2 | 08 | 08 | 2082 | 2022-05-01 |
v3 | 11 | 02 | 8763 | 2022-03-01 |
v3 | 11 | 05 | 5683 | 2022-03-01 |
v3 | 11 | 07 | 5780 | 2022-03-01 |