I am trying to create a variable that should be created based on the amount of years and the scoring of a contract.
This is an example of the target table, which is a double-entry table that contains the two main variables.
scoring | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
---|---|---|---|---|---|---|---|---|---|---|---|
9.3 | 0.00805% | 0.0283431% | 0.0283431% | 0.0464484% | 0.0464484% | 0.0464484% | 0.1196343% | 0.1196343% | 0.1562273% | 0.1562273% | 0.2595363% |
9.2 | 0.0102% | 0.0102% | 0.0476431% | 0.0875944% | 0.0875944% | 0.0875944% | 0.0875944% | 0.1434739% | 0.1434739% | 0.2072495% | 0.2072495% |
9.1 | 0.0383297% | 0.0835863% | 0.0835863% | 0.0835863% | 0.0835863% | 0.0835863% | 0.1810753% | 0.1810753% | 0.2259184% | 0.2259184% | 0.2259184% |
Here is an example of the expected result:
And I need to create a way to do the same with this database:
import pandas as pd
df = pd.DataFrame({'id':[80887618
,80887619
,80887620
,80887621
],
'years': [9,
1,
5,
12
],
'scoring': [9.3
,9.2
,9.1
,9.3
]
})
Thanks.