I am working on python and new to it.I have a dataframe as
Date Emailable Lost_Fans New_Fans Country
12-10-2020 121134 JP
06-11-2020 120859 350 75 JP
18-12-2020 101857 19128 126 JP
29-01-2021 105760 5029 8932 JP
16-02-2021 115437 1279 10956 JP
01-03-2021 115512 517 592 JP
12-07-2021 137546 18074 40108 JP
11-08-2021 134319 23753 20526 JP
02-09-2021 130156 4355 192 JP
- First,I want to find the missing month from the dataframe
- to fill the missing month data for lost and new split the last month data value of lost and new into these missing month lost and new column. For example: the april, may june is missing month from the above dataframe and the next data available is for july which contains 18074 in lost and 40108 in new. we need to spilt these values into the missing month(april, may, june) including july.so for lost 18074/4 =4518 to each of the missing month including july. so the final output will be like.
output should be:
Date Emailable Lost_Fans New_Fans Country
12-10-2020 121134 JP
06-11-2020 120859 350 75 JP
18-12-2020 101857 19128 126 JP
29-01-2021 105760 5029 8932 JP
16-02-2021 115437 1279 10956 JP
01-03-2021 115512 517 592 JP
30-04-2021 0 4518 10027 JP
31-05-2021 0 4518 10027 JP
30-06-2021 0 4518 10027 JP
12-07-2021 137546 4518 10027 JP
11-08-2021 134319 23753 20526 JP
02-09-2021 130156 4355 192 JP