I am working with huge data sets and I need to insert new rows where data is missing and interpolate it.
Data Values for each Group are in ascending order (we always have to start with 0.5 for each group) and the flag for missing data, as seen in the example, is when the value difference is larger than 0.5. The real problem starts when I need to combine it with the groupby
function so that Group "A" last value doesn't interfere with Group "B" first value.
df = pd.DataFrame({
"Group": ["A", "A", "A", "A", "A", "B", "B", "B", "B"],
"Value": [0.5, 1, 1.5, 2.5, 3, 1, 1.5, 2, 2.5]
})
And this is my desired result:
df = pd.DataFrame({
"Group": ["A", "A", "A", "A", "A", "A", "B", "B", "B", "B", "B"],
"Value": [0.5, 1, 1.5, 2, 2.5, 3, 0.5, 1, 1.5, 2, 2.5]
})