There are many similar questions here, but I could not find a single one that actually had observations with the same day and day. A minimal non-working example would be:
df = pd.DataFrame(
{"Date": np.tile([pd.Series(["2016-01", "2016-03"])], 2)[0],
"Group": [1,1,2,2],
"Obs":[1,2,5,6]})
Now I would like to linearly interpolate the value for February 2016 by the group, so the required result
Date Group Obs
2016-01 1 1
2016-02 1 1.5
2016-03 1 2
2016-01 2 5
2016-02 2 5.5
2016-03 2 6
My understanding is that I resampleshould be able to do this (in my actual application I am trying to move from quarter to month, so there are observations in January and April), but this requires some kind of time index, which I cannot do because Datethere are duplicates in the column .
I guess some kind of magic groupbycan help, but can't figure it out!