I have two tables:
Table 1: (Sales)
Code | 2025 | 2026 | 2027 |
---|---|---|---|
123 | 20000 | 21000 | 22000 |
456 | 10000 | 12000 | 14000 |
Table 2: (Inflation)
Code | 2020 | 2021 | 2022 | 2023 | 2024 | 2025 | 2026 | 2027 | 2028 |
---|---|---|---|---|---|---|---|---|---|
123 | 0.6 | 0.7 | 0.8 | 0.9 | 1 | 1.1 | 1.2 | 1.3 | 1.4 |
456 | 0.55 | 0.65 | 0.75 | 0.85 | 1 | 1.2 | 1.3 | 1.4 | 1.5 |
By using Python, I want to update Table (1) values by the inflation. for example for code “123” year “2025” which equal before inflation 20000. this value (20000) need to be updated by inflation rate located in table (2) which is equal 1.1 (the intersection of row 123 with column 2025 in table (2)). and the same for the other values.
The resulted table (1) should be:
Code | 2025 | 2026 | 2027 |
---|---|---|---|
123 | 22000 | 25200 | 28600 |
456 | 12000 | 15600 | 19600 |
New contributor
Mohamamd Khalil is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.