NLRequest an API key
Guides

How to interpolate time series data

Three steps: make the gaps visible, interpolate and check. Here with pandas, and with one API call.

Repair gaps in a time series with pandas

Missing timestamps only become a gap once they are in your series. So first put the series on a fixed interval. Then interpolate on time and check that nothing decreases.

import pandas as pd

readings = pd.Series(
    [12347.494, 12347.957],
    index=pd.to_datetime(["2026-11-27 08:00", "2026-11-27 08:45"]).tz_localize("Europe/Amsterdam"),
)

# 1. put the series on a fixed interval: missing timestamps become NaN
readings = readings.asfreq("15min")

# 2. interpolate on time, only between known readings
filled = readings.interpolate(method="time", limit_area="inside")

# 3. a reading must never decrease
assert not (filled.diff() < 0).any()
print(filled.round(3))
2026-11-27 08:00:00+01:00    12347.494
2026-11-27 08:15:00+01:00    12347.648
2026-11-27 08:30:00+01:00    12347.803
2026-11-27 08:45:00+01:00    12347.957
Freq: 15min, dtype: float64

Without limit_area="inside" pandas also fills after the last known value, repeating that last value. That is not interpolation. See the pandas documentation. pandas does not know a meter was replaced: if your series contains a decrease, do not interpolate across it.

With one API call

The same series to eclipse. The repaired values come back with the method and a code, and measured values stay as they were.

curl -X POST https://api.eclipseapi.nl/v1/fill \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{"interval": "PT15M", "series": [{"id": "meter-1", "values": [
    {"t": "2026-11-27T08:00:00+01:00", "consumption": 12347.494},
    {"t": "2026-11-27T08:15:00+01:00", "consumption": null},
    {"t": "2026-11-27T08:30:00+01:00", "consumption": null},
    {"t": "2026-11-27T08:45:00+01:00", "consumption": 12347.957}]}]}'
{
  "series": [{
    "status": "filled",
    "filled": [
      { "t": "2026-11-27T08:15:00+01:00", "consumption": 12347.649, "origin": "CLC" },
      { "t": "2026-11-27T08:30:00+01:00", "consumption": 12347.803, "origin": "CLC" }
    ],
    "flags": []
  }]
}

The response is shortened here. eclipse rounds per gap to whole Wh and keeps the total exact, so 08:15 is 12347.649 here and 12347.648 in pandas.

Which to choose

For a one-off dataset, pandas is enough. An API makes sense if you do this in several systems, or if you want the estimated values back marked as such. Also read what you should only flag.