I have the following dataframe
data = pd.DataFrame({
'date': [1988, 1989, 1990, 1991],
'value': [11558522, 12323552, 13770958, 18412280]
})
Out[1]:
date value
0 1988 11558522
1 1989 12323552
2 1990 13770958
3 1991 18412280
I then change the date colum to datetime index
data['date'] = pd.to_datetime(data['date'],format = '%Y')
Out[2]:
date value
0 1988-01-01 11558522
1 1989-01-01 12323552
2 1990-01-01 13770958
3 1991-01-01 18412280
I set the date column as the index
data = data.set_index('date')
Out[3]:
date value
1988-01-01 11558522
1989-01-01 12323552
1990-01-01 13770958
1991-01-01 18412280
Now i want to take a date value i.e 1988 and create the months ( 01 to 12 ) and take the value of that date (11558522) and divide it between the 12 months. so ultimately i want the dataset to look like this
date value
1988-01-01 889117.077
1988-02-01 889117.077
1988-03-01 889117.077
1988-04-01 889117.077
...
1988-12-01 889117.077
1989-01-01 947965.538
1989-02-01 947965.538
1989-03-01 947965.538
1989-04-01 947965.538
...
1989-12-01 947965.538
etc..
i want to do this for each date value in the dataframe. How best can i do this?