Hello I am dealing with a dataframe like below:
yearStart 2014 2015 2016 2017 2018 2019
0 2015 0 150 200 0 0 0
1 2016 0 0 200 140 35 10
2 2017 0 0 0 20 12 12
Typically, it is an financial report with all charges, begining when contract is signed (column 'year Start') and lasting during several years
yearStart Year+0 Year+1 Year+2 Year+3 Year+4 ... Year+N
0 2015 150 200 0 0 0
1 2016 200 140 35 0 0
2 2017 20 12 12 0 0
How to reshape the dataframe in order to have datas stored in a relative-date style from the first year of the contract .
I tried by iterrows() on each line and copy the relevant columns in another dataframe but it takes too much time...
EDIT:
Well I forgot to say that maybe one year in the relevant period of the contract, value is 0 and it shouldn't be forgetten. the columns to consider are between the date in yearStart and a end, given as a parameter. input is more like this:
0 2015 0 150 200 0 13 0
1 2016 0 0 200 140 35 0 10
2 2017 0 0 0 20 12 0 12
Thank you