I have a dataframe (df) of time series data in long format that has a variable ID and Day and Amount.
id day amount
1 41 15.29
1 42 15.29
1 43 15.29
1 44 15.29
1 45 15.3
1 46 15.3
1 47 15.3
1 48 15.31
1 49 15.31
1 50 15.31
1 52 15.32
1 53 15.32
1 54 15.32
1 55 15.32
1 58 15.33
1 59 15.34
1 60 15.34
1 61 15.34
Notice that day 51 is missing. What I want to do is locate the values that are out of missing and then add the row, and renumber then repeat for the entire df.
So it would end up like this:
1 41 15.29
1 42 15.29
1 43 15.29
1 44 15.29
1 45 15.3
1 46 15.3
1 47 15.3
1 48 15.31
1 49 15.31
1 50 15.31
-99 51 -99
1 52 15.32
1 53 15.32
1 54 15.32
1 55 15.32
1 58 15.33
1 59 15.34
1 60 15.34
1 61 15.34