I´m working on an energy investment projects dataframe (DF). In this DF I have two datetime type columns with ‘initial_data’ and ‘final_data’ and one float type column ‘total_cost’.
I need to create columns according to how much of this project is executed each year, using days as a proxy.
For example: project 1:
>>> ‘initial_data’ = 2013-07-01
>>> ‘final_data’ = 2015-06-30
>>> ‘total_cost’ = 2,000.00
For the given project, i need to create 3 columns and I should get the following results respectivelly:
>>> ‘total_cost_2013’ = 500.00
>>> ‘total_cost_2014’ = 1,000.00
>>> ‘total_cost_2015’ = 500.00`
I´m really struggling to do this. Does someone have a simple solution for that?
I expect to have the cost of the project for each year, according to the proportion of how many days in the year this project is executed.
Barbara Bressan Rocha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.